英文:
My go binaries end up in the src folder
问题
我的二进制文件最终会出现在src文件夹中,我不知道为什么会这样。我希望它们最终出现在gopath/bin文件夹中(因为那是默认设置?而且我不希望将二进制文件放在git上)。这些包最终会出现在gopath/pkg文件夹中,它们的二进制文件会出现在各自的文件夹中。我甚至不知道这种文件夹结构是否被认为是好的。
Gopath被设置为D:\驱动器上的gopath文件夹,而gobin没有被设置。
英文:
My binaries end up in the src folder and I have no idea why. I want them to end up in gopath/bin (since that is the default? and since I don't want binaries on git). The packages end up in gopath/pkg with their binaries in their respective folder. I don't even know if this folder structure is considered good.
Gopath is set to the gopath
folder on the D:\
drive, and gobin
is not set.
答案1
得分: 32
如果你可以将命令行参数传递给LiteIDE的go build
指令,你可以这样做:
go build -o $GOPATH/bin/outputfile.exe source.go
英文:
If you can pass a command line parameter to LiteIDE's go build
instruction, you can do something like this;
go build -o $GOPATH/bin/outputfile.exe source.go
答案2
得分: 20
如您在liteIDE FAQ中所见:
> <action id="BuildAndRun" img="blue/buildrun.png" key="Ctrl+R;Ctrl+F7" task="Build;Run"/> <action id="Install" menu="Build" img="blue/install.png" key="Ctrl+F8" cmd="$(GO)" args="install $(INSTALLARGS)" save="all" output="true"/>
- Build And Run 是
go build
。 - Install 是
go install
。
只有后者会在 GOPATH/bin
中构建您的可执行文件。
英文:
As you can see in the liteIDE FAQ:
> <action id="BuildAndRun" img="blue/buildrun.png" key="Ctrl+R;Ctrl+F7" task="Build;Run"/>
<action id="Install" menu="Build" img="blue/install.png" key="Ctrl+F8" cmd="$(GO)" args="install $(INSTALLARGS)" save="all" output="true"/>
- Build And Run is a
go build
. - Install is
go install
Only the latter would build your exe in GOPATH/bin
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论