From 8c1a19b8306886f76e8edf47827d0936f906692e Mon Sep 17 00:00:00 2001 From: foghost Date: Sat, 18 May 2024 17:31:28 +0800 Subject: [PATCH] since Consumer.Check default value is true, change method to WithClientNoCheck with Consumer.Check set to false --- client/options.go | 4 ++-- client/options_test.go | 4 ++-- dubbo.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/options.go b/client/options.go index 3536fc9d2d..57487c725b 100644 --- a/client/options.go +++ b/client/options.go @@ -531,9 +531,9 @@ func (cliOpts *ClientOptions) init(opts ...ClientOption) error { type ClientOption func(*ClientOptions) -func WithClientCheck() ClientOption { +func WithClientNoCheck() ClientOption { return func(opts *ClientOptions) { - opts.Consumer.Check = true + opts.Consumer.Check = false } } diff --git a/client/options_test.go b/client/options_test.go index c2edacc03c..66d7d9d0db 100644 --- a/client/options_test.go +++ b/client/options_test.go @@ -70,11 +70,11 @@ func TestWithClientCheck(t *testing.T) { { desc: "config check", opts: []ClientOption{ - WithClientCheck(), + WithClientNoCheck(), }, verify: func(t *testing.T, cli *Client, err error) { assert.Nil(t, err) - assert.Equal(t, true, cli.cliOpts.Consumer.Check) + assert.Equal(t, false, cli.cliOpts.Consumer.Check) }, }, } diff --git a/dubbo.go b/dubbo.go index ea9739b81b..3c9bc211ed 100644 --- a/dubbo.go +++ b/dubbo.go @@ -78,8 +78,8 @@ func (ins *Instance) NewClient(opts ...client.ClientOption) (*client.Client, err otelCfg := ins.insOpts.CloneOtel() if conCfg != nil { - if conCfg.Check { - cliOpts = append(cliOpts, client.WithClientCheck()) + if !conCfg.Check { + cliOpts = append(cliOpts, client.WithClientNoCheck()) } // these options come from Consumer and Root. // for dubbo-go developers, referring config/ConsumerConfig.Init and config/ReferenceConfig