Print line Developing in Go using fmt

xuanbao · · 664 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Does any one have any good workarounds for having to import fmt when wanting to print line debug. I&#39;ve been developing in Go for a couple months and have become a little irritated having to import fmt every time I want to print something to the command line then removing the import when I&#39;m done.</p> <hr/>**评论:**<br/><br/>koalainthetree: <pre><p>Have you looked into the go-imports tool? <a href="https://github.com/bradfitz/goimports" rel="nofollow">https://github.com/bradfitz/goimports</a></p> <p>It imports libraries automatically and gets rid of unused imports as well. </p></pre>btai24: <pre><p>does this work for atom?</p> <p>edit: yes it does, thanks</p></pre>koalainthetree: <pre><p>Yeah, do you have the go-plus plugin installed? <a href="https://atom.io/packages/go-plus" rel="nofollow">https://atom.io/packages/go-plus</a></p></pre>btai24: <pre><p>this is great ++</p></pre>djherbis: <pre><p>print and println are builtin as well <a href="https://golang.org/pkg/builtin/" rel="nofollow">https://golang.org/pkg/builtin/</a></p></pre>dlsniper: <pre><p>Try delve to discuss debug Go apps</p></pre>vhodges: <pre><p>Or you can leave traces in and just turn them off:</p> <p><a href="https://github.com/vhodges/dbg" rel="nofollow">https://github.com/vhodges/dbg</a></p></pre>lhxtx: <pre><p>Use a logging library that prints to a file and never unimport it. If you don&#39;t need the logs anymore, then print to /tmp or the equivalent on your deployment system. </p> <p>Edit: why the downvotes. Seriously trying to understand. </p></pre>

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

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