3 ms·
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
by tapirl 9y 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.
- buro9 9y agoExcept for the build conditional flags: https://golang.org/pkg/go/build/#hdr-Build_Constraints 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).
- vorg 9y agoAlso when you want to put package-main files in a library package directory, you need to put // +build ignore near the top of it.
- lurr 9y agoSo these features were totally not useful enough to be part fo the language, but you can't even build the compiler without them. Just like generics is totally useful enough to be used by parts of the runtime, but when it comes to including them in the lanuage they can't even think of a use case.