$Id: 264

$SOId: 8599

@draft

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.

Build tags

File suffix

Defining separate behaviors in different platforms