Skip to content

Commit

Permalink
Fixed documentation and example
Browse files Browse the repository at this point in the history
  • Loading branch information
lmbek committed Jul 22, 2024
1 parent 5932a57 commit 112760f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion example/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions example/go.sum
Original file line number Diff line number Diff line change
@@ -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=
7 changes: 4 additions & 3 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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
}
Expand All @@ -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
}

0 comments on commit 112760f

Please sign in to comment.