Hacker News new | ask | show | jobs
by tapirl 3084 days ago
The pragmas in Go are not intended to be used in general user code. They should be only used in Go runtime implementation and standard packages. The pragmas in Go are just some hints for compilers. Compilers will ignore many of the pragmas used in custom user code.
1 comments

Except for the build conditional flags: https://golang.org/pkg/go/build/#hdr-Build_Constraints

Which are pretty useful when you want to target tests to different versions of Go when std lib exhibits different behaviour (behaviour changed as std lib matured).

Also when you want to put package-main files in a library package directory, you need to put

  // +build ignore
near the top of it.