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
It is possible to completely replace spaces with comments in function signatures as seen in this abomination: https://play.golang.org/p/oZsc2uMjk7
What did you expect to see?
At the very least this should generate some kind of style warning and ideally an error along the lines of Expected IDENT following func.... That last example should absolutely not compile.
What did you see instead?
All examples above will compile and run just fine. No warnings or errors are generated for the sins you have just committed.
The text was updated successfully, but these errors were encountered:
@im-auld Go follows the tradition of any other language that is not line oriented: With the notable exception of automatic semicolon insertion, how you break your lines doesn't matter for the meaning of a program.
What version of Go are you using (
go version
)?go version go1.6.3 darwin/amd64
(also on the playground)What operating system and processor architecture are you using (
go env
)?According to the language spec defined here: https://golang.org/ref/spec#Lexical_elements
comments act like spaces. This also seems to be true in function definitions as seen here: https://play.golang.org/p/mJIRoAXM3u
This is also true in the creation of go routines seen here: https://play.golang.org/p/3ew1e917sC
It is possible to completely replace spaces with comments in function signatures as seen in this abomination: https://play.golang.org/p/oZsc2uMjk7
What did you expect to see?
At the very least this should generate some kind of style warning and ideally an error along the lines of
Expected IDENT following func...
. That last example should absolutely not compile.What did you see instead?
All examples above will compile and run just fine. No warnings or errors are generated for the sins you have just committed.
The text was updated successfully, but these errors were encountered: