On Mon, May 13, 2019 at 10:39 AM Neil Schellenberger
<neilschellenber...@gmail.com> wrote:
>
> The documentation of build constraints says, in part (emphasis mine):
>
>> Constraints may appear in any kind of source file (not just Go), but they 
>> must appear near the top of the file, preceded only by blank lines and other 
>> line comments.
>
>
> The current implementation (and presumably all past implementations) 
> explicitly enforces the constraint that a preceding general (i.e. non-line) 
> comment is not permitted.
>
> Does anyone remember the rationale for that?  Something to do with avoiding 
> undesired coincidental matching of comments in non-Go files?  I've done a 
> little forensic digging, but it quickly gets tricky as the code originated in 
> cmd/vet.
>
> I ran across this recently when attempting to insert a build constraint into 
> some of our existing Go code with a boilerplate corporate copyright which 
> started life in C/C++ source files.  It took me quite a while to figure out 
> what was going on....  :-)

The current approach lets you find all build constraints reliably with
a simple sed or awk script.  This is sometimes convenient.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUYkzADYySD%3D7u730XoXc17fhNJsSDEOVsnUxOASY6s8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to