Platform based conditional compiling comes in two forms in Go, one is with file suffixes and the other is with build tags.
// +build
", a single platform or a list can follow!
signCaveats for build tags:
// +build
constraint must be placed at the top of the file, even before package clause.List of valid platforms for both build tags and file suffixes |
---|
android |
darwin |
dragonfly |
freebsd |
linux |
netbsd |
openbsd |
plan9 |
solaris |
windows |
Refer to $GOOS
list in https://golang.org/doc/install/source#environment for the most up-to-date platform list.