Standard library / runtime

runtime.GOOS

Compile-time target operating system, not a dynamic host probe. Use build constraints for platform-specific code. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
const GOOS string

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime")
func main() { fmt.Println(runtime.GOOS != "") }
Go Reference