Essential Go  Edit on GitHub      File Issue

Developing for Multiple Platforms with Conditional Compiling

Platform based conditional compiling comes in two forms in Go, one is with file suffixes and the other is with build tags.

Syntax

Remarks

Caveats for build tags:

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.

Developing for Multiple Platforms with Conditional Compiling/
Build tags
File suffix
Defining separate behaviours in different platforms
  ↑ ↓ to navigate     ↵ to select     Esc to close