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