aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/dist/build.go37
-rw-r--r--src/cmd/go/alldocs.go1
-rw-r--r--src/cmd/go/internal/help/helpdoc.go1
3 files changed, 35 insertions, 4 deletions
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index ba09ce9a7b..4dfaf83ef7 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -976,12 +976,41 @@ func packagefile(pkg string) string {
return pathf("%s/pkg/%s_%s/%s.a", goroot, goos, goarch, pkg)
}
+// unixOS is the set of GOOS values matched by the "unix" build tag.
+// This is the same list as in go/build/syslist.go.
+var unixOS = map[string]bool{
+ "aix": true,
+ "android": true,
+ "darwin": true,
+ "dragonfly": true,
+ "freebsd": true,
+ "hurd": true,
+ "illumos": true,
+ "ios": true,
+ "linux": true,
+ "netbsd": true,
+ "openbsd": true,
+ "solaris": true,
+}
+
// matchtag reports whether the tag matches this build.
func matchtag(tag string) bool {
- return tag == "gc" || tag == goos || tag == goarch || tag == "cmd_go_bootstrap" || tag == "go1.1" ||
- (goos == "android" && tag == "linux") ||
- (goos == "illumos" && tag == "solaris") ||
- (goos == "ios" && tag == "darwin")
+ switch tag {
+ case "gc", "cmd_go_bootstrap", "go1.1":
+ return true
+ case "linux":
+ return goos == "linux" || goos == "android"
+ case "solaris":
+ return goos == "solaris" || goos == "illumos"
+ case "darwin":
+ return goos == "darwin" || goos == "ios"
+ case goos, goarch:
+ return true
+ case "unix":
+ return unixOS[goos]
+ default:
+ return false
+ }
}
// shouldbuild reports whether we should build this file.
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 8410731a28..f9d78b59e3 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -1844,6 +1844,7 @@
// GOOS environment variable.
// - the target architecture, as spelled by runtime.GOARCH, set with the
// GOARCH environment variable.
+// - "unix", if GOOS is a Unix or Unix-like system.
// - the compiler being used, either "gc" or "gccgo"
// - "cgo", if the cgo command is supported (see CGO_ENABLED in
// 'go help environment').
diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go
index 28ddaac8f1..36bc4f28b7 100644
--- a/src/cmd/go/internal/help/helpdoc.go
+++ b/src/cmd/go/internal/help/helpdoc.go
@@ -843,6 +843,7 @@ During a particular build, the following words are satisfied:
GOOS environment variable.
- the target architecture, as spelled by runtime.GOARCH, set with the
GOARCH environment variable.
+ - "unix", if GOOS is a Unix or Unix-like system.
- the compiler being used, either "gc" or "gccgo"
- "cgo", if the cgo command is supported (see CGO_ENABLED in
'go help environment').