From a8d5f21394cf1878d1ba187f67dca0dd9c72bc45 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 15 Jan 2024 02:01:49 +0300 Subject: [PATCH] fixup conditions Signed-off-by: Vasiliy Tolstov --- flag.go | 8 ++++++++ go.mod | 2 +- go.sum | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/flag.go b/flag.go index 9e7967a..083cd50 100644 --- a/flag.go +++ b/flag.go @@ -157,6 +157,10 @@ func (c *flagConfig) Init(opts ...options.Option) error { } func (c *flagConfig) Load(ctx context.Context, opts ...options.Option) error { + if c.opts.SkipLoad != nil && c.opts.SkipLoad(ctx, c) { + return nil + } + options := config.NewLoadOptions(opts...) _ = options @@ -175,6 +179,10 @@ func (c *flagConfig) Load(ctx context.Context, opts ...options.Option) error { } func (c *flagConfig) Save(ctx context.Context, opts ...options.Option) error { + if c.opts.SkipSave != nil && c.opts.SkipSave(ctx, c) { + return nil + } + if err := config.DefaultBeforeSave(ctx, c); err != nil && !c.opts.AllowFail { return err } diff --git a/go.mod b/go.mod index b1083fd..9ce9c91 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module go.unistack.org/micro-config-flag/v4 go 1.18 -require go.unistack.org/micro/v4 v4.0.5 +require go.unistack.org/micro/v4 v4.0.6 require ( github.com/google/uuid v1.3.0 // indirect diff --git a/go.sum b/go.sum index abbf684..40670f7 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,8 @@ go.unistack.org/micro/v4 v4.0.1 h1:xo1IxbVfgh8i0eY0VeYa3cbb13u5n/Mxnp3FOgWD4Jo= go.unistack.org/micro/v4 v4.0.1/go.mod h1:p/J5UcSJjfHsWGT31uKoghQ5rUQZzQJBAFy+Z4+ZVMs= go.unistack.org/micro/v4 v4.0.5 h1:uacmV8yHjCOtVfECc4w1tgp6bd3bBWrZa8X4iQLk48g= go.unistack.org/micro/v4 v4.0.5/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk= +go.unistack.org/micro/v4 v4.0.6 h1:YFWvTh3VwyOd6NHYTQcf47n2TF5+p/EhpnbuBQX3qhk= +go.unistack.org/micro/v4 v4.0.6/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk= 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/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=