About golang
Build Constraints (约束平台的编译)
Build constraints are a language construct that can be used to control the platforms and architectures on which a file will be compiled. They come in two flavors:
filename-based
Simple but inflexible
using filenames: <name>[_GOOS][_GOARCH].<extension>
(e.g. taskbar_windows.go
)
build constraint comment at top of file
More complex,much more flexible,and in my opinion much uglier
using file comments: // +build linux,386 darwin,!cgo
This comment must appear before any actual code in the file.
ref: