Today I Learned

2021/09/05

go

about go build constraints. Add

//go:build (booleanExprUsingTagNames)

to the top of the conditionally-included file. The boolean expression can be composed of tags (passed via go build -tag <tag>...) or expressions referencing the host or target os and arch.