-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
A bug that mutates a not-used copy of a struct #105423
Comments
/triage accepted |
/remove-sig testing |
@guodongli-google: There are no sig labels on this issue. Please add an appropriate label by using one of the following commands:
Please see the group list for a listing of the SIGs, working groups, and committees available. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign |
Filled the bug in the vendor's repository, we can close this now @guodongli-google |
looks like EnableContentEncoding() is not used by k/k code too. /close |
@neolit123: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What happened:
A static analyzer DeepGo reports a finding that reveals a coding issue.
What you expected to happen:
At https://github.com/kubernetes/kubernetes/blob/master/vendor/github.com/emicklei/go-restful/route.go#L168-L169
Here
Route
is struct which will be copied by value. The mutation on the value receiverr
doesn't do anything to the original struct in the caller. As a consequence, this mutation has no meaningful effect.One fix is to use pointer receiver.
Another possible fix is to write back
enabled
into the caller'scontentEncodingEnabled
:How to reproduce it (as minimally and precisely as possible):
A simplified bug reproducer is available at: https://play.golang.org/p/cibNCyIarZS
Anything else we need to know?:
Related issue: #105155
Found by #deepgo.
The text was updated successfully, but these errors were encountered: