From c36471b32522e153266341687a33235d08b15e44 Mon Sep 17 00:00:00 2001 From: Uwe Dauernheim Date: Tue, 29 Oct 2019 00:57:21 +0100 Subject: [PATCH] Update README example --- README.md | 16 +++++++++++++--- examples/minimal/main.go | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8f416e4..de5d347 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/examples/minimal/main.go b/examples/minimal/main.go index e7db9df..55cdb6e 100644 --- a/examples/minimal/main.go +++ b/examples/minimal/main.go @@ -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{}