本文介绍了我应该通过"go build"编译到哪些平台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有转到构建器支持的平台列表:

I have this list of supported platforms by the go builder:

    "darwin/386",
    "darwin/amd64",
    "dragonfly/amd64",
    "freebsd/386",
    "freebsd/amd64",
    "freebsd/arm",
    "linux/386",
    "linux/amd64",
    "linux/arm",
    "linux/arm64",
    "linux/ppc64",
    "linux/ppc64le",
    "linux/mips",
    "linux/mipsle",
    "linux/mips64",
    "linux/mips64le",
    "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",

我正在研究一个脚本来交叉编译我的项目.我首先将它们包括在内,但是现在我在项目中添加了更多代码,但无法为Plan9进行编译.我抬头看了Plan9,发现它确实很旧,不再使用了.所以我的问题是,实际使用哪些平台并值得对其进行编译?

I am working on a script to cross-compile my project. I started by including them all, but now I added some more code to my project and I couldn't compile it for Plan9. I looked Plan9 up and saw that it's really old and not used anymore. So my question is, which platforms are actually used and worth compiling to?

推荐答案

要列出所有受支持的平台( GOOS/GOARCH 组合),请使用以下命令:

To list all supported platforms (GOOS/GOARCH combinations), use the following command:

go tool dist list

将此列表作为您要/必须构建的平台的超集,并过滤掉不需要的平台(例如android).不要尝试构建未包含在此列表中的平台,否则将失败.

Take this list as a superset of platforms you want to / have to build to, and filter out those you don't need (e.g. android). Don't try to build to platforms not included in this list, it will fail.

对我来说(Go 1.13.3 linux/amd64)输出:

For me (Go 1.13.3 linux/amd64) it outputs:

aix/ppc64
android/386
android/amd64
android/arm
android/arm64
darwin/386
darwin/amd64
darwin/arm
darwin/arm64
dragonfly/amd64
freebsd/386
freebsd/amd64
freebsd/arm
illumos/amd64
js/wasm
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
netbsd/arm64
openbsd/386
openbsd/amd64
openbsd/arm
openbsd/arm64
plan9/386
plan9/amd64
plan9/arm
solaris/amd64
windows/386
windows/amd64
windows/arm

这篇关于我应该通过"go build"编译到哪些平台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 07:09