且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何确定程序是在 Go 中构建为 32 位还是 64 位?

更新时间:2023-09-27 08:03:10

使用GOARCH for arm:arm(ARM)和arm64(AArch64),

Use GOARCH for arm: arm (ARM) and arm64 (AArch64),

可选环境变量

$GOOS 和 $GOARCH

$GOOS and $GOARCH

目标操作系统和编译架构的名称.这些分别默认为 $GOHOSTOS 和 $GOHOSTARCH 的值(如下所述).

The name of the target operating system and compilation architecture. These default to the values of $GOHOSTOS and $GOHOSTARCH respectively (described below).

$GOOS 的选择是

Choices for $GOOS are

$GOOS     $GOARCH
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     ppc64
linux     ppc64le
linux     mips64
linux     mips64le
netbsd    386
netbsd    amd64
netbsd    arm
openbsd   386
openbsd   amd64
openbsd   arm
plan9     386
plan9     amd64
solaris   amd64
windows   386
windows   amd64