Title: Go 1.4 starts to use comments as directives. I think that is a realy bad path to go on the long run. You see its beginnings in following 3 examples:<p># used to set a canonical import path for a package:
&#x2F;&#x2F;import &quot;foo&quot;<p># used to generate code:
&#x2F;&#x2F;go:generate bar<p># used to document the result of a example function:
&#x2F;&#x2F;Output: foo<p>Comments should not be directives. Comments are free form, they do not have a syntax (as demonstrated in the examples). Comments are for humans - programms should ignore them or threat them as - comments!<p>It is my optinion that if Go needs some kind of annotation, than there should be a new syntax for it.<p>I would propose that directives to the tool chain will be marked with<p>#TAG: DIRECTIVE<p>a tool would be able to register the TAG with the go build environment. If a TAG is found in the code - the tool is called to do what ever needs to be done.
Upvote: