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

sean-public opened this issue Mar 4, 2017 · 1 comment


None yet
5 participants
Copy link

commented Mar 4, 2017

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


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


What did you do?

Attempt to call init()

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


This comment has been minimized.

Copy link

commented Mar 4, 2017

Dup of #8481, fixed on tip by cb6e063.

@ALTree ALTree closed this 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.
You can’t perform that action at this time.