diff --git a/src/go/build/build.go b/src/go/build/build.go index dce0304ba48..baf76e6b7ff 100644 --- a/src/go/build/build.go +++ b/src/go/build/build.go @@ -1965,18 +1965,6 @@ func (ctxt *Context) goodOSArchFile(name string, allTags map[string]bool) bool { return true } -var knownOS = make(map[string]bool) -var knownArch = make(map[string]bool) - -func init() { - for _, v := range strings.Fields(goosList) { - knownOS[v] = true - } - for _, v := range strings.Fields(goarchList) { - knownArch[v] = true - } -} - // ToolDir is the directory containing build tools. var ToolDir = getToolDir() diff --git a/src/go/build/syslist.go b/src/go/build/syslist.go index 0f6e3369253..6b62b63042b 100644 --- a/src/go/build/syslist.go +++ b/src/go/build/syslist.go @@ -4,8 +4,51 @@ package build -// List of past, present, and future known GOOS and GOARCH values. +// Past, present, and future known GOOS and GOARCH values. // Do not remove from this list, as these are used for go/build filename matching. -const goosList = "aix android darwin dragonfly freebsd hurd illumos ios js linux nacl netbsd openbsd plan9 solaris windows zos " -const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be loong64 mips mipsle mips64 mips64le mips64p32 mips64p32le ppc ppc64 ppc64le riscv riscv64 s390 s390x sparc sparc64 wasm " +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, + "windows": true, + "zos": true, +} +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, +}