What is /tmp/goc-build-xxxxx directory?

huangapple go评论77阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2021年9月29日 12:02:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/69370253.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定