Skip to content

Commit

Permalink
Merge pull request #8 from voi-go/update-readme-example
Browse files Browse the repository at this point in the history
Update README example
  • Loading branch information
djui authored Oct 28, 2019
2 parents 82e0928 + c36471b commit 504026a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,27 @@ package main

import (
"github.com/voi-go/svc"
"go.uber.org/zap"
)

var _ svc.Worker = (*dummyWorker)(nil)

type dummyWorker struct{}

func (d *dummyWorker) Init(*zap.Logger) error { return nil }
func (d *dummyWorker) Terminate() error { return nil }
func (d *dummyWorker) Run() error { select {} }

func main() {
s, err := svc.New("minimal-service", "0.0.1")
s, err := svc.New("minimal-service", "1.0.0")
svc.MustInit(s, err)

w := NewMyWorker()
s.AddWorker("my-worker", w)
w := &dummyWorker{}
s.AddWorker("dummy-worker", w)

s.Run()
}

```

For more details, see the examples.
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (d *dummyWorker) Terminate() error { return nil }
func (d *dummyWorker) Run() error { select {} }

func main() {
s, err := svc.New("minimal-service", "v0.0.1")
s, err := svc.New("minimal-service", "1.0.0")
svc.MustInit(s, err)

w := &dummyWorker{}
Expand Down

0 comments on commit 504026a

Please sign in to comment.