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 linesThis will output something like:
main.go22 chars3 lines
Here are the possible values for runtime.GOOS:
darwin (OS X)dragonfly (DragonFly BSD)freebsdlinuxnetbsdopenbsdplan9solariswindowsgistlibby LogSnag