All possible GOOS value?

后端 未结 3 553
说谎
说谎 2021-01-30 12:25

If I get it right, GOOS is determined when compile the source code.

To better support multiple OS, I\'m interested in what GOOS could be.

3条回答
  •  猫巷女王i
    2021-01-30 13:15

    You can see the list of supported platform by running:

    go tool dist list

    and this will print(depending on the Go version):

    android/386
    android/amd64
    android/arm
    android/arm64
    darwin/386
    darwin/amd64
    darwin/arm
    darwin/arm64
    dragonfly/amd64
    freebsd/386
    freebsd/amd64
    freebsd/arm
    linux/386
    linux/amd64
    linux/arm
    linux/arm64
    linux/mips
    linux/mips64
    linux/mips64le
    linux/mipsle
    linux/ppc64
    linux/ppc64le
    linux/s390x
    nacl/386
    nacl/amd64p32
    nacl/arm
    netbsd/386
    netbsd/amd64
    netbsd/arm
    openbsd/386
    openbsd/amd64
    openbsd/arm
    plan9/386
    plan9/amd64
    plan9/arm
    solaris/amd64
    windows/386
    windows/amd64
    

    And the official documentation for the tool:

    https://godoc.org/github.com/golang/go/src/cmd/dist

    To cross compile use:

    GOOS=darwin GOARCH=386 go build main.go
    

提交回复
热议问题