Essential Go  Suggest an edit

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: * The // +build constraint must be placed at the top of the file, even before package clause. * It must be followed by one blank line to separate from package comments.

List of valid platforms for both build tags and file suffixesandroiddarwindragonflyfreebsdlinuxnetbsdopenbsdplan9solariswindows

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 behaviors in different platforms
  ↑ ↓ to navigate     ↵ to select     Esc to close