Conditional compilation in Golang

When developing Go package or application that depends on specific features of the underlying platform or architecture it is often necessary to use a specialised implementation. There are two parts of Go conditional compilation system, which we will now explore in more detail. Build constraints A build constraints (known as build tags) is an optional top line comment that starts with // +build package api Declaration of build constraints follows the following rules:...

August 16, 2015 · 4 min · Svetlin Ralchev