diff --git a/file.go b/file.go index 7b1db0d..2a40d99 100644 --- a/file.go +++ b/file.go @@ -4,10 +4,9 @@ import ( "context" "fmt" "io" - "io/ioutil" "os" - "github.com/imdario/mergo" + "dario.cat/mergo" "go.unistack.org/micro/v3/codec" "go.unistack.org/micro/v3/config" rutil "go.unistack.org/micro/v3/util/reflect" @@ -70,7 +69,7 @@ func (c *fileConfig) Load(ctx context.Context, opts ...config.LoadOption) error } } - fp, err := os.OpenFile(path, os.O_RDONLY, os.FileMode(0400)) + fp, err := os.OpenFile(path, os.O_RDONLY, os.FileMode(0o400)) if err != nil { if !c.opts.AllowFail { return fmt.Errorf("file load path %s error: %w", path, err) @@ -84,7 +83,7 @@ func (c *fileConfig) Load(ctx context.Context, opts ...config.LoadOption) error defer fp.Close() - buf, err := ioutil.ReadAll(io.LimitReader(fp, int64(codec.DefaultMaxMsgSize))) + buf, err := io.ReadAll(io.LimitReader(fp, int64(codec.DefaultMaxMsgSize))) if err != nil { if !c.opts.AllowFail { return err @@ -162,7 +161,7 @@ func (c *fileConfig) Save(ctx context.Context, opts ...config.SaveOption) error return nil } - fp, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, os.FileMode(0600)) + fp, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, os.FileMode(0o600)) if err != nil { if !c.opts.AllowFail { return err diff --git a/go.mod b/go.mod index 3ec0500..a7fd981 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module go.unistack.org/micro-config-file/v3 go 1.18 require ( - github.com/imdario/mergo v0.3.16 - go.unistack.org/micro/v3 v3.10.36 + dario.cat/mergo v1.0.0 + go.unistack.org/micro/v3 v3.10.44 ) -require github.com/google/uuid v1.5.0 // indirect +require github.com/google/uuid v1.6.0 // indirect diff --git a/go.sum b/go.sum index 9a5e3af..6e528eb 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,9 @@ -github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= -github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= -go.unistack.org/micro/v3 v3.10.16 h1:2er/SKKYbV60M+UuJM4eYCF0MZYAIq/yNUrAbTfgq8Q= -go.unistack.org/micro/v3 v3.10.16/go.mod h1:uMAc0U/x7dmtICCrblGf0ZLgYegu3VwQAquu+OFCw1Q= -go.unistack.org/micro/v3 v3.10.36 h1:+XPhpguDC0HldSePp5TODdMJ06+IUy1AQkYN7ub84DA= -go.unistack.org/micro/v3 v3.10.36/go.mod h1:eUgtvbtiiz6te93m0ZdmoecbitWwjdBmmr84srmEIKA= +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +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/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=