Merge branch 'master' into master
Some checks failed
automerge / automerge (pull_request) Failing after 14s
dependabot-automerge / automerge (pull_request) Has been skipped
autoapprove / autoapprove (pull_request) Failing after 35s
lint / lint (pull_request) Successful in 1m36s
test / test (pull_request) Successful in 13m52s

This commit is contained in:
Василий Толстов 2024-12-12 11:51:43 +03:00
commit bf925ed29f
3 changed files with 19 additions and 17 deletions

10
go.mod
View File

@ -1,14 +1,16 @@
module go.unistack.org/micro-config-service/v4 module go.unistack.org/micro-config-service/v4
go 1.20 go 1.21
toolchain go1.23.4
require ( require (
dario.cat/mergo v1.0.0 dario.cat/mergo v1.0.1
go.unistack.org/micro/v4 v4.0.17 go.unistack.org/micro/v4 v4.0.17
google.golang.org/protobuf v1.33.0 google.golang.org/protobuf v1.35.2
) )
require ( require (
github.com/google/go-cmp v0.5.9 // indirect github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect github.com/google/uuid v1.6.0 // indirect
) )

9
go.sum
View File

@ -1,13 +1,10 @@
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 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= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
go.unistack.org/micro/v4 v4.0.17 h1:mF7uM+J4ILdG+1fcwzKYCwDlxhdbF/e1WnGzKKLnIXc= go.unistack.org/micro/v4 v4.0.17 h1:mF7uM+J4ILdG+1fcwzKYCwDlxhdbF/e1WnGzKKLnIXc=
go.unistack.org/micro/v4 v4.0.17/go.mod h1:ZDgU9931vm2l7X6RN/6UuwRIVp24GRdmQ7dKmegArk4= go.unistack.org/micro/v4 v4.0.17/go.mod h1:ZDgU9931vm2l7X6RN/6UuwRIVp24GRdmQ7dKmegArk4=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
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

@ -28,12 +28,15 @@ func (c *serviceConfig) Options() config.Options {
} }
func (c *serviceConfig) Init(opts ...options.Option) error { func (c *serviceConfig) Init(opts ...options.Option) error {
if err := config.DefaultBeforeInit(c.opts.Context, c); err != nil && !c.opts.AllowFail { var err error
if err = config.DefaultBeforeInit(c.opts.Context, c); err != nil && !c.opts.AllowFail {
return err return err
} }
for _, o := range opts { for _, o := range opts {
o(&c.opts) if err = o(&c.opts); err != nil {
return err
}
} }
var cli client.Client var cli client.Client
@ -47,12 +50,12 @@ func (c *serviceConfig) Init(opts ...options.Option) error {
} }
if cli == nil { if cli == nil {
err := fmt.Errorf("missing client option") err = fmt.Errorf("missing client option")
if !c.opts.AllowFail { if !c.opts.AllowFail {
return err return err
} }
if err := config.DefaultAfterInit(c.opts.Context, c); err != nil && !c.opts.AllowFail { if err = config.DefaultAfterInit(c.opts.Context, c); err != nil && !c.opts.AllowFail {
return err return err
} }
@ -60,12 +63,12 @@ func (c *serviceConfig) Init(opts ...options.Option) error {
} }
if c.service == "" { if c.service == "" {
err := fmt.Errorf("missing Service option") err = fmt.Errorf("missing Service option")
if !c.opts.AllowFail { if !c.opts.AllowFail {
return err return err
} }
if err := config.DefaultAfterInit(c.opts.Context, c); err != nil && !c.opts.AllowFail { if err = config.DefaultAfterInit(c.opts.Context, c); err != nil && !c.opts.AllowFail {
return err return err
} }
@ -74,7 +77,7 @@ func (c *serviceConfig) Init(opts ...options.Option) error {
c.client = pbmicro.NewConfigServiceClient(c.service, cli) c.client = pbmicro.NewConfigServiceClient(c.service, cli)
if err := config.DefaultAfterInit(c.opts.Context, c); err != nil && !c.opts.AllowFail { if err = config.DefaultAfterInit(c.opts.Context, c); err != nil && !c.opts.AllowFail {
return err return err
} }