|
@@ -5,6 +5,7 @@ import (
|
|
|
"log"
|
|
|
|
|
|
"git.p78su.freemyip.com/svi/gostore/internal/service"
|
|
|
+ "git.p78su.freemyip.com/svi/gostore/pkg/types"
|
|
|
)
|
|
|
|
|
|
var (
|
|
@@ -14,18 +15,23 @@ var (
|
|
|
Date = ""
|
|
|
// GoVersion -- версия компилятора
|
|
|
GoVersion = ""
|
|
|
+ serv types.IService
|
|
|
+ err error
|
|
|
)
|
|
|
|
|
|
func main() {
|
|
|
log.Printf("gostore/main():\n\tgo\t= %v\n\tvers\t= %v\n\tdate\t= %v\n", GoVersion, Version, Date)
|
|
|
- serv, err := service.NewService()
|
|
|
- if err != nil {
|
|
|
- log.Printf("main(): in create IService, err=\n\t%v\n", err)
|
|
|
- return
|
|
|
- }
|
|
|
- if err := serv.Run(); err != nil {
|
|
|
- log.Printf("main(): in work IService, err=\n\t%v\n", err)
|
|
|
- return
|
|
|
+ if serv == nil {
|
|
|
+ serv, err = service.NewService()
|
|
|
+ if err != nil {
|
|
|
+ log.Printf("main(): in create IService, err=\n\t%v\n", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
+ run(serv)
|
|
|
log.Printf("main(): end\n")
|
|
|
}
|
|
|
+
|
|
|
+func run(serv types.IService) {
|
|
|
+ serv.Run()
|
|
|
+}
|