You can use the runtime.GOOS
constant to get the operating system name and runtime.GOARCH
constant to get the architecture name in Go:
main.go122 chars11 lines
This will output something like:
main.go22 chars3 lines
Here are the possible values for runtime.GOOS
:
darwin
(OS X)dragonfly
(DragonFly BSD)freebsd
linux
netbsd
openbsd
plan9
solaris
windows
gistlibby LogSnag