You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/tmp/sandbox961476762/main.go:5: undefined: x
/tmp/sandbox961476762/main.go:5: undefined: y
/tmp/sandbox961476762/main.go:5: undefined: z
It would be nice if these said something along the lines of "no type provided in function signature" rather than undefined. This would be closer to the case where the final type is omitted (http://play.golang.org/p/TvhumXNd3Z)
/tmp/sandbox992442913/main.go:5: final function parameter must have type
The text was updated successfully, but these errors were encountered:
The error message is correct. From the compiler's standpoint, you have
defined a function that takes three arguments, whose types are x, y, and
z.
But x, y, z are not defined, thus it gives the undefined message.
It's hard to give intuitive error messages for Go's declarations, because
it's too flexible.
Closing this. Feel free to reopen if you have a suggestion for what the compiler can reasonably do. Note that this is not a syntax error, and that the compiler can't know that the names are undefined until parsing is complete.
If one leaves out the types in a function signature (as in http://play.golang.org/p/dxiOWN_NS4)
The error is
It would be nice if these said something along the lines of "no type provided in function signature" rather than undefined. This would be closer to the case where the final type is omitted (http://play.golang.org/p/TvhumXNd3Z)
The text was updated successfully, but these errors were encountered: