Goland remove unused import?

blov · · 1550 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>The latest release mentioned this feature. Is it removing unused import on saving the file?</p> <blockquote> <p>Last but not least, the Auto Import has been made smarter and prevents you from adding undesired import statements (GO-5118).</p> </blockquote> <p><a href="https://blog.jetbrains.com/go/2018/02/15/goland-2018-1-eap-3-move-refactoring-better-test-runner-go-build-quickdoc-and-more/" rel="nofollow">https://blog.jetbrains.com/go/2018/02/15/goland-2018-1-eap-3-move-refactoring-better-test-runner-go-build-quickdoc-and-more/</a></p> <hr/>**评论:**<br/><br/>dlsniper: <pre><blockquote> <p>The latest release mentioned this feature. Is it removing unused import on saving the file?</p> </blockquote> <p>No, this is removing the import as soon as it&#39;s not used in the file anymore, without saving the file, it&#39;s what I&#39;ve mentioned here: <a href="https://www.reddit.com/r/golang/comments/82ilek/does_goland_support_automatically_remove_unused/dvace3n/" rel="nofollow">https://www.reddit.com/r/golang/comments/82ilek/does_goland_support_automatically_remove_unused/dvace3n/</a></p></pre>marksteve4: <pre><p>I downloaded the latest version. But this doesn&#39;t seem to work. Do I need to have some setup? all my import options are checked.</p></pre>dlsniper: <pre><p>I think it&#39;s better if you open an issue on <a href="https://youtrack.jetbrains.com/issues/Go" rel="nofollow">https://youtrack.jetbrains.com/issues/Go</a> as I&#39;m not sure if this is the best place to get help for this. My initial thought would be to ask you for a screenshot of <code>Settings | Go | Imports</code>.</p></pre>jackie_pwn_asses: <pre><p>I believe that it is idiomatic go to manually delete the import with the backspace key. It&#39;s important to be aware of the changes you&#39;re making to your code. How would you feel if the IDE automatically <em>added</em> imports to your program? </p> <p>As a programmer you should be aware that you&#39;ve removed a dependency. </p></pre>Justinsaccount: <pre><blockquote> <p>How would you feel if the IDE automatically added imports to your program?</p> </blockquote> <p>vim-go does this with goimports and I feel great about it.</p></pre>

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

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