Edit stdlib for tracing or debugging

blov · · 290 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hello. I recently got a stack trace of my program. One of the lines in that trace said something like this.</p> <pre><code>os/exec.(*Cmd).Wait(0xc420094840, 0x0, 0x0) /usr/local/Cellar/go/1.7.1/libexec/src/os/exec/exec.go:442 +0x221 </code></pre> <p>I wanted to edit that file to add a <code>fmt.Println</code> in order to print some info. So, I did just that and saved it.</p> <p>However when I <code>go build</code> my program, my print statements never get called. I know I&#39;ve done this before and it has worked. Did something change recently or is there a stdlib cache I can clear somewhere?</p> <hr/>**评论:**<br/><br/>cs-guy: <pre><p>If it&#39;s been a while (say more than two years) since you have done this, then perhaps you used to use <code>go build -a</code>. The behavior of <code>go build -a</code> changed in <a href="https://golang.org/doc/go1.4" rel="nofollow">Go 1.4</a></p> <blockquote> <p>The behavior of the go build subcommand&#39;s -a flag has been changed for non-development installations. For installations running a released distribution, the -a flag will no longer rebuild the standard library and commands, to avoid overwriting the installation&#39;s files.</p> </blockquote></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

290 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传