diff --git a/README.md b/README.md index 28f4e6a..075749a 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ func main() { // loadService - creates a new service and starts it func loadService() { // creating new service with name and graceful shutdown time duration - service := ggservice.NewService("SSG Service", 5*time.Second) + service := ggservice.NewService("SSG Service", 5*time.Second, "arg1", "arg2") // starting the service (please note you can choose to not implement any of these by using nil instead) waitgroup := &sync.WaitGroup{} @@ -60,7 +60,7 @@ func loadService() { } // start runs when the service starts -func start() error { +func start(args ...any) error { fmt.Println("starting function") return nil } @@ -74,9 +74,11 @@ func run() error { } // forceExit is being run when the application is trying to force a shutdown (non-gracefully) -func forceExit() { +func forceExit() error { log.Fatalln(errors.New("forced stop: timeout")) + return nil } + ``` ## Contributors diff --git a/example/go.mod b/example/go.mod index 9e29c22..20f09ba 100644 --- a/example/go.mod +++ b/example/go.mod @@ -2,4 +2,4 @@ module example go 1.22 -require github.com/lmbek/ggservice v0.0.1 +require github.com/lmbek/ggservice v1.3.0 diff --git a/example/go.sum b/example/go.sum index 4142277..2e73aa8 100644 --- a/example/go.sum +++ b/example/go.sum @@ -1,2 +1,2 @@ -github.com/lmbek/ggservice v0.0.1 h1:mEilAgiXFsg9vKkO29WpVo18JVa60pVU6AjnNRnP/k8= -github.com/lmbek/ggservice v0.0.1/go.mod h1:WeUwfPy3SOcZV6IH700psgyvIK1ZzYqztnbMW3EEcBk= +github.com/lmbek/ggservice v1.3.0 h1:qd1sWy4RW4Kn0CFhQ+NkXDwV9wUES+i2rhrhTAch8k0= +github.com/lmbek/ggservice v1.3.0/go.mod h1:WeUwfPy3SOcZV6IH700psgyvIK1ZzYqztnbMW3EEcBk= diff --git a/example/main.go b/example/main.go index 2095cd0..e9e3289 100644 --- a/example/main.go +++ b/example/main.go @@ -16,7 +16,7 @@ func main() { // loadService - creates a new service and starts it func loadService() { // creating new service with name and graceful shutdown time duration - service := ggservice.NewService("SSG Service", 5*time.Second) + service := ggservice.NewService("SSG Service", 5*time.Second, "arg1", "arg2") // starting the service (please note you can choose to not implement any of these by using nil instead) waitgroup := &sync.WaitGroup{} @@ -37,7 +37,7 @@ func loadService() { } // start runs when the service starts -func start() error { +func start(args ...any) error { fmt.Println("starting function") return nil } @@ -51,6 +51,7 @@ func run() error { } // forceExit is being run when the application is trying to force a shutdown (non-gracefully) -func forceExit() { +func forceExit() error { log.Fatalln(errors.New("forced stop: timeout")) + return nil }