英文:
Why does go install creates an executable in bin\windows_386?
问题
每当我运行go install relative\path\to\package时,它会创建二进制文件,但将它们放在名为windows_386的文件夹中,该文件夹位于$GOPATH\bin文件夹中。我有意将GOARCH设置为386。我在Windows 10专业版上运行go 1.17.1,如果这些信息有关的话。
我的理论是我设置了GOARCH,但以一种“本地”的方式,全局的GOARCH仍然是amd64,每当我安装带有386架构的包时,它们就会被放在这个子文件夹中。然而,我还没有找到任何文献来证实我的怀疑,希望能得到一些见解。
英文:
Whenever I run go install relative\path\to\package it creates the binaries but places them in a folder called windows_386 in the $GOPATH\bin folder. I purposely set GOARCH to the value 386. I'm running go 1.17.1 on Windows 10 Pro edition if this information is relevant.
My theory is that I set GOARCH but in a "local" way, the "global" GOARCH is still amd64 and whenever I install packages with 386 architecture, it puts them in this subfolder. I haven't been able to find any literature to confirm my suspicion though and would like some insight.
答案1
得分: 1
我在2014年提到过go install会遵循GOARCH的设置。
"编译和安装包及其依赖项"部分确实确认了:
当禁用模块感知模式时,其他包会安装在目录
$GOPATH/pkg/$GOOS_$GOARCH中。
英文:
I mentioned in 2014 that go install would respect GOARCH
The "Compile and install packages and dependencies" section do confirm that:
> When module-aware mode is disabled, other packages are installed in the directory $GOPATH/pkg/$GOOS_$GOARCH
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论