Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix miss makezero bug #2682

Merged
merged 1 commit into from
May 30, 2024
Merged

Conversation

alingse
Copy link
Contributor

@alingse alingse commented May 26, 2024

I was running github actions to run linter makezero for top github golang repos.

see issues alingse/go-linter-runner#1

and the github actions output https://github.com/alingse/go-linter-runner/actions/runs/9242652074/job/25425741161

====================================================================================================
append to slice `vhs` with non-zero initialized length at https://github.com/apache/dubbo-go/blob/main/xds/client/resource/filter_chain.go#L119:9
append to slice `keyList` with non-zero initialized length at https://github.com/apache/dubbo-go/blob/main/protocol/dubbo3/dubbo3_protocol.go#L156:13
append to slice `in` with non-zero initialized length at https://github.com/apache/dubbo-go/blob/main/proxy/proxy_factory/pass_through.go#L[10](https://github.com/alingse/go-linter-runner/actions/runs/9242652074/job/25425741161#step:4:11)5:7
append to slice `in` with non-zero initialized length at https://github.com/apache/dubbo-go/blob/main/proxy/proxy_factory/pass_through.go#L106:7
append to slice `in` with non-zero initialized length at https://github.com/apache/dubbo-go/blob/main/proxy/proxy_factory/pass_through.go#L107:7
append to slice `in` with non-zero initialized length at https://github.com/apache/dubbo-go/blob/main/proxy/proxy_factory/pass_through.go#L108:7
append to slice `in` with non-zero initialized length at https://github.com/apache/dubbo-go/blob/main/proxy/proxy_factory/pass_through.go#L109:7
append to slice `subInstances` with non-zero initialized length at https://github.com/apache/dubbo-go/blob/main/registry/servicediscovery/service_instances_changed_listener_impl.go#L[11](https://github.com/alingse/go-linter-runner/actions/runs/9242652074/job/25425741161#step:4:12)9:36
====================================================================================================

the vhs , keyList , subInstances is easy to check that they are bugs and they need make the slice to zero length.

but the other lines has var in that linter reported, I don't know if they are some special usage, so I wasn't commit them.

	in := make([]reflect.Value, 5) // maybe should replace with  in := make([]reflect.Value, 0, 5)
	in = append(in, srv.Rcvr())
	in = append(in, reflect.ValueOf(invocation.MethodName()))
	in = append(in, reflect.ValueOf(invocation.GetAttachmentInterface(constant.ParamsTypeKey)))
	in = append(in, reflect.ValueOf(args))
	in = append(in, reflect.ValueOf(invocation.Attachments()))

Signed-off-by: alingse <alingse@foxmail.com>
Copy link

sonarcloud bot commented May 26, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@AlexStocks AlexStocks merged commit 104fae2 into apache:main May 30, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants