为了账号安全,请及时绑定邮箱和手机立即绑定

如何在 GoClipse 中启用自动导入?

如何在 GoClipse 中启用自动导入?

Go
潇潇雨雨 2021-11-22 20:06:33
根据这篇文章,可以在 GoClipse 中启用自动导入:1) install goimports:go get code.google.com/p/go.tools/cmd/goimports2) in eclipse goto: Preferences -> Go -> Go Formatter and set it to be the path of the goimports binThis will fix all imports when you format. If you combine this with #67, then imports will be automatically fixed on save.问题当我尝试在 Eclipse 中搜索 Go Formatter 时,我找不到它。

1 回答

?
明月笑刀无情

TA贡献1828条经验 获得超4个赞

我的眼睛注意到的一件事:

我知道 goimports URL 不再是 google.com/p/go.tools/cmd/goimports。

因此,让我们尝试以下操作:

  1. 执行 go get golang.org/x/tools/cmd/goimports

  2. Preferences->Go

  3. 设置gofmt${GOPATH}/bin/goimports(这是 goimports 所在的位置)

  4. 重新启动Eclipse,并确保它使用goimportsCTRLSHIFT+F被按下。


查看完整回答
反对 回复 2021-11-22
  • 1 回答
  • 0 关注
  • 176 浏览
慕课专栏
更多

添加回答

代码语言

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号