File: os.go

package info (click to toggle)
golang-github-juju-utils 0.0~git20171220.f38c0b0-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,748 kB
  • sloc: makefile: 20
file content (41 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (3)
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
}