Skip to content

Commit f4e7d68

Browse files
committed
imports: add 'UnixOS' list of Unix-like systems
From Go 1.19, the build constraint 'unix' proposed in golang/go#20322 is satisfied by any sufficiently Unix-like value of GOOS, as defined by src/go/build/syslist.go. This commit adds a 'UnixOS' list containing the values of GOOS that would satisfy the 'unix' constraint in Go 1.19.
1 parent 9d15b66 commit f4e7d68

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

imports/build.go

+13-4
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,26 @@ func MatchFile(name string, tags map[string]bool) bool {
195195
return true
196196
}
197197

198-
var KnownOS = make(map[string]bool)
199-
var KnownArch = make(map[string]bool)
198+
var (
199+
KnownOS = make(map[string]bool)
200+
UnixOS = make(map[string]bool)
201+
KnownArch = make(map[string]bool)
202+
)
200203

201204
func init() {
202205
for _, v := range strings.Fields(goosList) {
203206
KnownOS[v] = true
204207
}
208+
for _, v := range strings.Fields(unixList) {
209+
UnixOS[v] = true
210+
}
205211
for _, v := range strings.Fields(goarchList) {
206212
KnownArch[v] = true
207213
}
208214
}
209215

210-
const goosList = "aix android darwin dragonfly freebsd hurd illumos ios js linux nacl netbsd openbsd plan9 solaris windows zos "
211-
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 "
216+
const (
217+
goosList = "aix android darwin dragonfly freebsd hurd illumos ios js linux nacl netbsd openbsd plan9 solaris windows zos "
218+
unixList = "aix android darwin dragonfly freebsd hurd illumos ios linux netbsd openbsd solaris "
219+
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 "
220+
)

0 commit comments

Comments
 (0)