3 Commits

Author SHA1 Message Date
c325b0a760 Merge pull request 'move to micro v4' (#76) from v4 into master
Some checks failed
build / test (push) Failing after 7s
build / lint (push) Failing after 4s
codeql / analyze (go) (push) Failing after 5s
Reviewed-on: #76
2023-05-05 19:58:39 +03:00
05cb25c2e1 move to micro v4
Some checks failed
prbuild / test (pull_request) Failing after 5s
prbuild / lint (pull_request) Failing after 5s
codeql / analyze (go) (pull_request) Failing after 5s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-05-05 19:57:12 +03:00
bc599cddb3 Merge branch 'v3' 2023-05-05 19:56:08 +03:00
5 changed files with 11 additions and 25 deletions

14
flag.go
View File

@@ -1,4 +1,4 @@
package flag package flag // import "go.unistack.org/micro-config-flag/v4"
import ( import (
"context" "context"
@@ -10,8 +10,8 @@ import (
"strings" "strings"
"time" "time"
"go.unistack.org/micro/v3/config" "go.unistack.org/micro/v4/config"
rutil "go.unistack.org/micro/v3/util/reflect" rutil "go.unistack.org/micro/v4/util/reflect"
) )
var ( var (
@@ -156,10 +156,6 @@ func (c *flagConfig) Init(opts ...config.Option) error {
} }
func (c *flagConfig) Load(ctx context.Context, opts ...config.LoadOption) error { func (c *flagConfig) Load(ctx context.Context, opts ...config.LoadOption) error {
if c.opts.SkipLoad != nil && c.opts.SkipLoad(ctx, c) {
return nil
}
options := config.NewLoadOptions(opts...) options := config.NewLoadOptions(opts...)
_ = options _ = options
@@ -178,10 +174,6 @@ func (c *flagConfig) Load(ctx context.Context, opts ...config.LoadOption) error
} }
func (c *flagConfig) Save(ctx context.Context, opts ...config.SaveOption) error { func (c *flagConfig) Save(ctx context.Context, opts ...config.SaveOption) error {
if c.opts.SkipSave != nil && c.opts.SkipSave(ctx, c) {
return nil
}
if err := config.DefaultBeforeSave(ctx, c); err != nil && !c.opts.AllowFail { if err := config.DefaultBeforeSave(ctx, c); err != nil && !c.opts.AllowFail {
return err return err
} }

View File

@@ -7,7 +7,7 @@ import (
"testing" "testing"
"time" "time"
"go.unistack.org/micro/v3/config" "go.unistack.org/micro/v4/config"
) )
func TestLoad(t *testing.T) { func TestLoad(t *testing.T) {

7
go.mod
View File

@@ -2,9 +2,6 @@ module go.unistack.org/micro-config-flag/v3
go 1.18 go 1.18
require go.unistack.org/micro/v3 v3.10.44 require go.unistack.org/micro/v4 v4.0.1
require ( require github.com/imdario/mergo v0.3.14 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/google/uuid v1.6.0 // indirect
)

10
go.sum
View File

@@ -1,9 +1,7 @@
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= github.com/imdario/mergo v0.3.14 h1:fOqeC1+nCuuk6PKQdg9YmosXX7Y7mHX6R/0ZldI9iHo=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/imdario/mergo v0.3.14/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= go.unistack.org/micro/v4 v4.0.1 h1:xo1IxbVfgh8i0eY0VeYa3cbb13u5n/Mxnp3FOgWD4Jo=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= go.unistack.org/micro/v4 v4.0.1/go.mod h1:p/J5UcSJjfHsWGT31uKoghQ5rUQZzQJBAFy+Z4+ZVMs=
go.unistack.org/micro/v3 v3.10.44 h1:Vgyy9BrJOSdFvo29/klrgIBE/Nme9E8udPAljos34o0=
go.unistack.org/micro/v3 v3.10.44/go.mod h1:erMgt3Bl7vQQ0e9UpQyR5NlLiZ9pKeEJ9+1tfYFaqUg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@@ -3,7 +3,7 @@ package flag
import ( import (
"flag" "flag"
"go.unistack.org/micro/v3/config" "go.unistack.org/micro/v4/config"
) )
type sliceDelimKey struct{} type sliceDelimKey struct{}
@@ -55,7 +55,6 @@ func FlagUsage(fn func()) config.Option {
return config.SetOption(flagSetUsageKey{}, fn) return config.SetOption(flagSetUsageKey{}, fn)
} }
type flagEnvKey struct{} type flagEnvKey struct{}
// FlagEnv set flag set usage func // FlagEnv set flag set usage func