我如何追踪导致`go build`花费很长时间的原因?

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

How can I track down what is causing `go build` to take a long time?

问题

运行带有-v选项并不能真正告诉我问题出在哪里。甚至在打印出一行内容之前,需要大约20秒的时间。

strace下运行会输出很多噪音,而且strace在Mac OS上无法运行。

删除依赖项以查看它们是否是问题将需要大量的工作量。

英文:

Running it with -v does not really tell me what the problem is. It takes about 20s before printing even a single line.

Running it under strace outputs a lot of noise, and strace does not run on Mac OS.

Removing dependencies to see if they are the problem would be a ridiculous amount of work.

答案1

得分: 5

你可以使用-x标志来显示正在执行的所有命令:

https://godocs.io/cmd/go#hdr-Compile_packages_and_dependencies

英文:

You can use the -x flag to show all commands being executed:

https://godocs.io/cmd/go#hdr-Compile_packages_and_dependencies

huangapple
  • 本文由 发表于 2022年2月11日 04:28:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/71071868.html
匿名

发表评论

匿名网友

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

确定