-
Notifications
You must be signed in to change notification settings - Fork 18k
Proposal: runtime: Error propagation not issued for function parameters if not used within function body. #70921
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
Comments
@gopherbot, please add labels NeedsFix |
@gopherbot, please add labels compiler/runtime |
A function may not use one of its parameters in the following cases:
That said, the proposed change is not backward-compatible and would require modifying existing code. |
Duplicate of #39118 |
Related Issues
Related Discussions (Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
Go version
go version go1.23.2 X:boringcrypto linux/amd64
Output of
go env
in your module/workspace:What did you do?
https://go.dev/play/p/a4Xm3Eidkd0
What did you see happen?
In above mentioned snippet i.e https://go.dev/play/p/a4Xm3Eidkd0 , demoStr is declared as parameter to function but never used within function.
What did you expect to see?
In above mentioned snippet i.e. https://go.dev/play/p/a4Xm3Eidkd0 , This should raise error for demoStr as its not being used within function, agnostic of caller is passing or not. If its defined as parameter it should be consumed.
The text was updated successfully, but these errors were encountered: