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

cmd/compile: More helpful error message when trying to call init() #19399

Closed
sean-public opened this issue Mar 4, 2017 · 1 comment
Closed
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@sean-public
Copy link

What version of Go are you using (go version)?

1.8

What operating system and processor architecture are you using (go env)?

any

What did you do?

Attempt to call init()

https://play.golang.org/p/enueQhZnFA

What did you expect to see?

An error message indicating that you cannot call init; despite it appearing as a normal function in the source, it is actually a reserved function name that isn't actually declared / callable. To a newcomer who accidentally names a function init, this would be much more insightful.

What did you see instead?

main.go:12: undefined: init
@bradfitz bradfitz added this to the Go1.9Maybe milestone Mar 4, 2017
@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 4, 2017
@ALTree
Copy link
Member

ALTree commented Mar 4, 2017

Dup of #8481, fixed on tip by cb6e063.

@ALTree ALTree closed this as completed Mar 4, 2017
@golang golang locked and limited conversation to collaborators Mar 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

5 participants