because the no space style is reserved for comment pragmas
Obviously this isn't quite true. Counter-example is // +build ...
stuff where there is a space between '//' and '+'.
Yes, // +build
is an exception that comes from pre-1.0 times. It doesn't invalidate the point made here. The main reason for this entry is consistency with existing code.
There was a proposal to rename // +build
to //go:build
, which is likely what it would've been if it were created after the //go:
compiler directive convention was established. The proposal was rejected because the change would incur too much churn without enough benefits to justify it.
Do this:
Don't do this:
For consistency, and because the no space style is reserved for comment pragmas, for example:
Temporarily commented out code should also have no spaces, but it's not meant to be committed.
See https://golang.org/cmd/compile/#hdr-Compiler_Directives.