From 2089311c856efe401db86148b552f3399e0d1210 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Wed, 27 Oct 2021 22:56:15 +0300 Subject: [PATCH] update deps Signed-off-by: Vasiliy Tolstov --- flag.go | 2 ++ flag_test.go | 6 ++---- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flag.go b/flag.go index 82bd9c1..93da9aa 100644 --- a/flag.go +++ b/flag.go @@ -52,6 +52,7 @@ func (c *flagConfig) Init(opts ...config.Option) error { fn, fv, fd := getFlagOpts(tf) rcheck := true + switch sf.Value.Interface().(type) { case time.Duration: err = c.flagDuration(sf.Value, fn, fv, fd) @@ -60,6 +61,7 @@ func (c *flagConfig) Init(opts ...config.Option) error { err = c.flagTime(sf.Value, fn, fv, fd) rcheck = false } + if err != nil { c.opts.Logger.Errorf(c.opts.Context, "flag init error: %v", err) if !c.opts.AllowFail { diff --git a/flag_test.go b/flag_test.go index c87fd43..e83d742 100644 --- a/flag_test.go +++ b/flag_test.go @@ -30,11 +30,11 @@ func TestLoad(t *testing.T) { c := NewConfig(config.Struct(cfg), TimeFormat(time.RFC822)) if err := c.Init(); err != nil { - t.Fatal(err) + t.Fatalf("init failed: %v", err) } if err := c.Load(ctx); err != nil { - t.Fatal(err) + t.Fatalf("load failed: %v", err) } if cfg.Broker != "5566:33" { @@ -43,6 +43,4 @@ func TestLoad(t *testing.T) { if tf := cfg.Time.Format(time.RFC822); tf != "02 Jan 06 14:32 MSK" { t.Fatalf("parse time error: %v", cfg.Time) } - - t.Logf("cfg %#+v", cfg) } diff --git a/go.mod b/go.mod index 0cd8ceb..0062d59 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module go.unistack.org/micro-config-flag/v3 go 1.16 -require go.unistack.org/micro/v3 v3.8.5 +require go.unistack.org/micro/v3 v3.8.7 diff --git a/go.sum b/go.sum index 28e6754..195a70b 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTK github.com/silas/dag v0.0.0-20210626123444-3804bac2d6d4/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA= go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8= -go.unistack.org/micro/v3 v3.8.5 h1:DIYWRsQF+NPhKZP45sCtNsUhaRw6u2+Ps7U+pKU7i3s= -go.unistack.org/micro/v3 v3.8.5/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA= +go.unistack.org/micro/v3 v3.8.7 h1:k1zOpJ3uS8MxdhK8annRsa5J/LW7MpqPjwYuekW61wE= +go.unistack.org/micro/v3 v3.8.7/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA= golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=