From e3545532e81f8dce07aede90fcd1d6bdf37763af Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 21 Aug 2021 01:00:10 +0300 Subject: [PATCH] minor changes Signed-off-by: Vasiliy Tolstov --- meter/handler/handler_micro.pb.go | 2 +- server/health/health_micro.pb.go | 6 +++--- util/id/id.go | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/meter/handler/handler_micro.pb.go b/meter/handler/handler_micro.pb.go index 45ad4c43..513ffbb7 100644 --- a/meter/handler/handler_micro.pb.go +++ b/meter/handler/handler_micro.pb.go @@ -14,7 +14,7 @@ var ( MeterName = "Meter" MeterEndpoints = []api.Endpoint{ - api.Endpoint{ + { Name: "Meter.Metrics", Path: []string{"/metrics"}, Method: []string{"GET"}, diff --git a/server/health/health_micro.pb.go b/server/health/health_micro.pb.go index 33de7c19..abc56529 100644 --- a/server/health/health_micro.pb.go +++ b/server/health/health_micro.pb.go @@ -14,19 +14,19 @@ var ( HealthName = "Health" HealthEndpoints = []api.Endpoint{ - api.Endpoint{ + { Name: "Health.Live", Path: []string{"/live"}, Method: []string{"GET"}, Handler: "rpc", }, - api.Endpoint{ + { Name: "Health.Ready", Path: []string{"/ready"}, Method: []string{"GET"}, Handler: "rpc", }, - api.Endpoint{ + { Name: "Health.Version", Path: []string{"/version"}, Method: []string{"GET"}, diff --git a/util/id/id.go b/util/id/id.go index 382ba344..b07359ac 100644 --- a/util/id/id.go +++ b/util/id/id.go @@ -1,9 +1,12 @@ package id import ( + "context" "crypto/rand" "errors" "math" + + "github.com/unistack-org/micro/v3/logger" ) // DefaultAlphabet is the alphabet used for ID characters by default @@ -64,11 +67,11 @@ func New(opts ...Option) (string, error) { } } -// Must is the same as New but panics on error +// Must is the same as New but fatals on error func Must(opts ...Option) string { id, err := New(opts...) if err != nil { - panic(err) + logger.Fatal(context.TODO(), err) } return id }