We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
At https://github.com/emicklei/go-restful/blob/v3/route.go#L176-L178 Here Route is struct which will be copied by value. The mutation on the value receiver r doesn't do anything to the original struct in the caller. As a consequence, this mutation has no meaningful effect.
r
type Route struct { Method string ... contentEncodingEnabled *bool } func (r Route) EnableContentEncoding(enabled bool) { r.contentEncodingEnabled = &enabled }
One fix is to use pointer receiver.
func (r *Route) EnableContentEncoding(enabled bool) { r.contentEncodingEnabled = &enabled }
Another possible fix is to write back enabled into the caller'scontentEncodingEnabled :
func (r Route) EnableContentEncoding(enabled bool) { *r.contentEncodingEnabled = enabled }
How to reproduce it (as minimally and precisely as possible): A simplified bug reproducer is available at: https://play.golang.org/p/cibNCyIarZS
Initially filled in Kubernetes
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
At https://github.com/emicklei/go-restful/blob/v3/route.go#L176-L178
Here Route is struct which will be copied by value. The mutation on the value receiver
r
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
Initially filled in Kubernetes
The text was updated successfully, but these errors were encountered: