英文:
What is /tmp/goc-build-xxxxx directory?
问题
当我使用dlv调试我的应用程序时,我发现我的应用程序是从/tmp/goc-build-7e5b20ef452c/
构建的,而我的源代码目录是/git.company.com/service/
。
此外,当我执行cd /tmp/goc-build-7e5b20ef452c/
时,终端提示我“没有这个文件或目录”。
我在go build /git.company.com/service/
之后运行了我的应用程序。
英文:
When I use dlv to debug my application, I found that my application is built from /tmp/goc-build-7e5b20ef452c/
, and my source code directory is /git.company.com/service/
.
Further, When I exec cd /tmp/goc-build-7e5b20ef452c/
, the terminal prompts me
No such file or directory
I run my application after go build /git.company.com/service/
答案1
得分: 1
go build
会将go env GOTMPDIR
作为构建过程中的临时文件夹。如果go env GOTMPDIR
为空,它会回退到$TMP
(或Windows上的%TMP%
/%TMPDIR%
)。
由于它是一个临时文件夹,在退出时会被清理掉。
英文:
go build
will use go env GOTMPDIR
as a temporary folder for building.
If go env GOTMPDIR
is empty, it falls back to $TMP
(or %TMP%
/%TMPDIR%
on Windows)
Since it is a temporary folder, it is cleaned up at exit.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论