"errors"
"fmt"
"go/build/constraint"
+ "internal/syslist"
"strings"
"unicode"
)
case "darwin":
return tags["ios"]
case "unix":
- return unixOS[cfg.BuildContext.GOOS]
+ return syslist.UnixOS[cfg.BuildContext.GOOS]
default:
return false
}
l = l[:n-1]
}
n := len(l)
- if n >= 2 && KnownOS[l[n-2]] && KnownArch[l[n-1]] {
+ if n >= 2 && syslist.KnownOS[l[n-2]] && syslist.KnownArch[l[n-1]] {
return matchTag(l[n-2], tags, true) && matchTag(l[n-1], tags, true)
}
- if n >= 1 && KnownOS[l[n-1]] {
+ if n >= 1 && syslist.KnownOS[l[n-1]] {
return matchTag(l[n-1], tags, true)
}
- if n >= 1 && KnownArch[l[n-1]] {
+ if n >= 1 && syslist.KnownArch[l[n-1]] {
return matchTag(l[n-1], tags, true)
}
return true
}
-
-var KnownOS = map[string]bool{
- "aix": true,
- "android": true,
- "darwin": true,
- "dragonfly": true,
- "freebsd": true,
- "hurd": true,
- "illumos": true,
- "ios": true,
- "js": true,
- "linux": true,
- "nacl": true, // legacy; don't remove
- "netbsd": true,
- "openbsd": true,
- "plan9": true,
- "solaris": true,
- "wasip1": true,
- "windows": true,
- "zos": true,
-}
-
-// unixOS is the set of GOOS values matched by the "unix" build tag.
-// This is not used for filename matching.
-// This is the same list as in go/build/syslist.go and cmd/dist/build.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,
-}
-
-var KnownArch = map[string]bool{
- "386": true,
- "amd64": true,
- "amd64p32": true, // legacy; don't remove
- "arm": true,
- "armbe": true,
- "arm64": true,
- "arm64be": true,
- "ppc64": true,
- "ppc64le": true,
- "mips": true,
- "mipsle": true,
- "mips64": true,
- "mips64le": true,
- "mips64p32": true,
- "mips64p32le": true,
- "loong64": true,
- "ppc": true,
- "riscv": true,
- "riscv64": true,
- "s390": true,
- "s390x": true,
- "sparc": true,
- "sparc64": true,
- "wasm": true,
-}
"go/build"
"go/build/constraint"
"go/token"
+ "internal/syslist"
"io"
"io/fs"
"path/filepath"
if ctxt.GOOS == "ios" && name == "darwin" {
return true
}
- if name == "unix" && unixOS[ctxt.GOOS] {
+ if name == "unix" && syslist.UnixOS[ctxt.GOOS] {
return true
}
if name == "boringcrypto" {
l = l[:n-1]
}
n := len(l)
- if n >= 2 && knownOS[l[n-2]] && knownArch[l[n-1]] {
+ if n >= 2 && syslist.KnownOS[l[n-2]] && syslist.KnownArch[l[n-1]] {
if allTags != nil {
// In case we short-circuit on l[n-1].
allTags[l[n-2]] = true
}
return ctxt.matchTag(l[n-1], allTags) && ctxt.matchTag(l[n-2], allTags)
}
- if n >= 1 && (knownOS[l[n-1]] || knownArch[l[n-1]]) {
+ if n >= 1 && (syslist.KnownOS[l[n-1]] || syslist.KnownArch[l[n-1]]) {
return ctxt.matchTag(l[n-1], allTags)
}
return true
+++ /dev/null
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This file is a lightly modified copy go/build/syslist_test.go.
-
-package modindex
-
-// knownOS is the list of past, present, and future known GOOS values.
-// Do not remove from this list, as it is used for filename matching.
-// If you add an entry to this list, look at unixOS, below.
-var knownOS = map[string]bool{
- "aix": true,
- "android": true,
- "darwin": true,
- "dragonfly": true,
- "freebsd": true,
- "hurd": true,
- "illumos": true,
- "ios": true,
- "js": true,
- "linux": true,
- "nacl": true,
- "netbsd": true,
- "openbsd": true,
- "plan9": true,
- "solaris": true,
- "wasip1": true,
- "windows": true,
- "zos": true,
-}
-
-// unixOS is the set of GOOS values matched by the "unix" build tag.
-// This is not used for filename matching.
-// This list also appears in cmd/dist/build.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,
-}
-
-// knownArch is the list of past, present, and future known GOARCH values.
-// Do not remove from this list, as it is used for filename matching.
-var knownArch = map[string]bool{
- "386": true,
- "amd64": true,
- "amd64p32": true,
- "arm": true,
- "armbe": true,
- "arm64": true,
- "arm64be": true,
- "loong64": true,
- "mips": true,
- "mipsle": true,
- "mips64": true,
- "mips64le": true,
- "mips64p32": true,
- "mips64p32le": true,
- "ppc": true,
- "ppc64": true,
- "ppc64le": true,
- "riscv": true,
- "riscv64": true,
- "s390": true,
- "s390x": true,
- "sparc": true,
- "sparc64": true,
- "wasm": true,
-}
package script
import (
- "cmd/go/internal/imports"
"fmt"
+ "internal/syslist"
"os"
"runtime"
"sync"
if suffix == runtime.GOOS {
return true, nil
}
- if _, ok := imports.KnownOS[suffix]; !ok {
+ if _, ok := syslist.KnownOS[suffix]; !ok {
return false, fmt.Errorf("unrecognized GOOS %q", suffix)
}
return false, nil
if suffix == runtime.GOARCH {
return true, nil
}
- if _, ok := imports.KnownArch[suffix]; !ok {
+ if _, ok := syslist.KnownArch[suffix]; !ok {
return false, fmt.Errorf("unrecognized GOOS %q", suffix)
}
return false, nil
"internal/goroot"
"internal/goversion"
"internal/platform"
+ "internal/syslist"
"io"
"io/fs"
"os"
if ctxt.GOOS == "ios" && name == "darwin" {
return true
}
- if name == "unix" && unixOS[ctxt.GOOS] {
+ if name == "unix" && syslist.UnixOS[ctxt.GOOS] {
return true
}
if name == "boringcrypto" {
l = l[:n-1]
}
n := len(l)
- if n >= 2 && knownOS[l[n-2]] && knownArch[l[n-1]] {
+ if n >= 2 && syslist.KnownOS[l[n-2]] && syslist.KnownArch[l[n-1]] {
if allTags != nil {
// In case we short-circuit on l[n-1].
allTags[l[n-2]] = true
}
return ctxt.matchTag(l[n-1], allTags) && ctxt.matchTag(l[n-2], allTags)
}
- if n >= 1 && (knownOS[l[n-1]] || knownArch[l[n-1]]) {
+ if n >= 1 && (syslist.KnownOS[l[n-1]] || syslist.KnownArch[l[n-1]]) {
return ctxt.matchTag(l[n-1], allTags)
}
return true
internal/nettrace,
internal/platform,
internal/profilerecord,
+ internal/syslist,
internal/trace/traceviewer/format,
log/internal,
math/bits,
go/doc/comment, go/parser, internal/lazyregexp, text/template
< go/doc;
- go/build/constraint, go/doc, go/parser, internal/buildcfg, internal/goroot, internal/goversion, internal/platform
+ go/build/constraint, go/doc, go/parser, internal/buildcfg, internal/goroot, internal/goversion, internal/platform, internal/syslist
< go/build;
# databases
var goarches []string
func main() {
- data, err := os.ReadFile("../../go/build/syslist.go")
+ data, err := os.ReadFile("../../internal/syslist/syslist.go")
if err != nil {
log.Fatal(err)
}
- const goarchPrefix = `var knownArch = map[string]bool{`
+ const goarchPrefix = `var KnownArch = map[string]bool{`
inGOARCH := false
for _, line := range strings.Split(string(data), "\n") {
if strings.HasPrefix(line, goarchPrefix) {
var gooses []string
func main() {
- data, err := os.ReadFile("../../go/build/syslist.go")
+ data, err := os.ReadFile("../../internal/syslist/syslist..go")
if err != nil {
log.Fatal(err)
}
- const goosPrefix = `var knownOS = map[string]bool{`
+ const goosPrefix = `var KnownOS = map[string]bool{`
inGOOS := false
for _, line := range strings.Split(string(data), "\n") {
if strings.HasPrefix(line, goosPrefix) {
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package build
+// Package syslist stores tables of OS and ARCH names that are
+// (or at one point were) acceptable build targets.
+
+package syslist
// Note that this file is read by internal/goarch/gengoarch.go and by
// internal/goos/gengoos.go. If you change this file, look at those
// files as well.
-// knownOS is the list of past, present, and future known GOOS values.
+// KnownOS is the list of past, present, and future known GOOS values.
// Do not remove from this list, as it is used for filename matching.
-// If you add an entry to this list, look at unixOS, below.
-var knownOS = map[string]bool{
+// If you add an entry to this list, look at UnixOS, below.
+var KnownOS = map[string]bool{
"aix": true,
"android": true,
"darwin": true,
"zos": true,
}
-// unixOS is the set of GOOS values matched by the "unix" build tag.
+// UnixOS is the set of GOOS values matched by the "unix" build tag.
// This is not used for filename matching.
// This list also appears in cmd/dist/build.go and
// cmd/go/internal/imports/build.go.
-var unixOS = map[string]bool{
+var UnixOS = map[string]bool{
"aix": true,
"android": true,
"darwin": true,
"solaris": true,
}
-// knownArch is the list of past, present, and future known GOARCH values.
+// KnownArch is the list of past, present, and future known GOARCH values.
// Do not remove from this list, as it is used for filename matching.
-var knownArch = map[string]bool{
+var KnownArch = map[string]bool{
"386": true,
"amd64": true,
"amd64p32": true,