forked from mitchellh/gox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
platform.go
66 lines (57 loc) · 1.07 KB
/
platform.go
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"fmt"
"strings"
)
// Platform is a combination of OS/arch that can be built against.
type Platform struct {
OS string
Arch string
}
func (p *Platform) String() string {
return fmt.Sprintf("%s/%s", p.OS, p.Arch)
}
var (
OsList = []string{
"darwin",
"linux",
"freebsd",
"netbsd",
"openbsd",
"plan9",
"windows",
}
ArchList = []string{
"386",
"amd64",
"arm",
}
Platforms_1_0 = []Platform{
{"darwin", "386"},
{"darwin", "amd64"},
{"linux", "386"},
{"linux", "amd64"},
{"linux", "arm"},
{"freebsd", "386"},
{"freebsd", "amd64"},
{"openbsd", "386"},
{"openbsd", "amd64"},
{"windows", "386"},
{"windows", "amd64"},
}
Platforms_1_1 = append(Platforms_1_0, []Platform{
{"freebsd", "arm"},
{"netbsd", "386"},
{"netbsd", "amd64"},
{"netbsd", "arm"},
{"plan9", "386"},
}...)
)
// SupportedPlatforms returns the full list of supported platforms for
// the version of Go that is
func SupportedPlatforms(v string) []Platform {
if strings.HasPrefix(v, "go1.0") {
return Platforms_1_0
}
return Platforms_1_1
}