diff --git a/README.md b/README.md index 42efb64..192e099 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,7 @@ func main() { fin.Add(srv) go func() { - err := srv.ListenAndServe() - if err != http.ErrServerClosed { + if err := srv.ListenAndServe(); err != http.ErrServerClosed { log.Fatal(err) } }() @@ -99,8 +98,7 @@ func main() { fin.Add(srv) go func() { - err := srv.ListenAndServe() - if err != http.ErrServerClosed { + if err := srv.ListenAndServe(); err != http.ErrServerClosed { log.Fatal(err) } }() @@ -141,8 +139,7 @@ func main() { fin.Add(srv) go func() { - err := srv.ListenAndServe() - if err != http.ErrServerClosed { + if err := srv.ListenAndServe(); err != http.ErrServerClosed { log.Fatal(err) } }() @@ -183,8 +180,7 @@ func main() { fin.Add(srv) go func() { - err := srv.ListenAndServe() - if err != http.ErrServerClosed { + if err := srv.ListenAndServe(); err != http.ErrServerClosed { log.Fatal(err) } }() @@ -242,16 +238,14 @@ func main() { go func() { logrus.Infof("starting public server at %s", srvPub.Addr) - err := srvPub.ListenAndServe() - if err != http.ErrServerClosed { + if err := srvPub.ListenAndServe(); err != http.ErrServerClosed { log.Fatal(err) } }() go func() { logrus.Infof("starting internal server at %s", srvInt.Addr) - err := srvInt.ListenAndServe() - if err != http.ErrServerClosed { + if err := srvInt.ListenAndServe(); err != http.ErrServerClosed { log.Fatal(err) } }() diff --git a/example_test.go b/example_test.go index ed50997..4758e33 100644 --- a/example_test.go +++ b/example_test.go @@ -21,8 +21,7 @@ func Example() { fin.Add(srv) go func() { - err := srv.ListenAndServe() - if err != http.ErrServerClosed { + if err := srv.ListenAndServe(); err != http.ErrServerClosed { log.Fatal(err) } }() diff --git a/finish.go b/finish.go index 6ccf72f..7f7e0ee 100644 --- a/finish.go +++ b/finish.go @@ -161,8 +161,7 @@ func (f *Finisher) Wait() { ctx, cancel := context.WithTimeout(context.Background(), keeper.timeout) defer cancel() f.log().Infof("finish: shutting down %s ...", keeper.name) - err := keeper.srv.Shutdown(ctx) - if err != nil { + if err := keeper.srv.Shutdown(ctx); err != nil { if err == context.DeadlineExceeded { f.log().Errorf("finish: shutdown timeout for %s", keeper.name) } else { diff --git a/finish_test.go b/finish_test.go index 626e13f..98a3f87 100644 --- a/finish_test.go +++ b/finish_test.go @@ -267,8 +267,7 @@ func TestOptionError(t *testing.T) { fin := New() func() { defer func() { - err := recover() - if err != errTest { + if err := recover(); err != errTest { t.Error("expected Add() to panic") } }()