cmd/compile: More helpful error message when trying to call init() #19399
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
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 functioninit
, this would be much more insightful.What did you see instead?
The text was updated successfully, but these errors were encountered: