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

Comments

Projects
None yet
5 participants
@sean-public
Copy link

commented Mar 4, 2017

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

@ALTree

This comment has been minimized.

Copy link
Member

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.