Skip to content

Commit

Permalink
since Consumer.Check default value is true, change method to WithClie…
Browse files Browse the repository at this point in the history
…ntNoCheck with Consumer.Check set to false
  • Loading branch information
FoghostCn committed May 18, 2024
1 parent 955c6d6 commit 8c1a19b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions client/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
4 changes: 2 additions & 2 deletions client/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions dubbo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8c1a19b

Please sign in to comment.