1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
// Copyright 2015 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
package utils
// These are the names of the operating systems recognized by Go.
const (
OSWindows = "windows"
OSDarwin = "darwin"
OSDragonfly = "dragonfly"
OSFreebsd = "freebsd"
OSLinux = "linux"
OSNacl = "nacl"
OSNetbsd = "netbsd"
OSOpenbsd = "openbsd"
OSSolaris = "solaris"
)
// OSUnix is the list of unix-like operating systems recognized by Go.
// See http://golang.org/src/path/filepath/path_unix.go.
var OSUnix = []string{
OSDarwin,
OSDragonfly,
OSFreebsd,
OSLinux,
OSNacl,
OSNetbsd,
OSOpenbsd,
OSSolaris,
}
// OSIsUnix determines whether or not the given OS name is one of the
// unix-like operating systems recognized by Go.
func OSIsUnix(os string) bool {
for _, goos := range OSUnix {
if os == goos {
return true
}
}
return false
}
|