如何在GoClipse中启用自动导入? [英] How to enable autoimport in GoClipse?

查看:234
本文介绍了如何在GoClipse中启用自动导入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据这篇文章,可以在GoClipse中启用自动导入:


  1)install goimports:
去获取code.google.com/p/go.tools/ cmd / goimports

2)在eclipse中goto:Preferences - >去 - > Go格式化程序并将其设置为goimports bin的路径

这将在您格式化时修复所有导入。如果将此与#67结合使用,则导入将自动保存在保存状态。


问题



当我尝试在Eclipse中搜索Go Formatter时,我无法找到它。
$ b



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



因此,我们试试以下内容:


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

  2. 转到首选项 - > 转到

  3. 设置 gofmt 到 $ {GOPATH} / bin / goimports (这是goimports所在的位置)
  4. 重新启动 Eclipse 并确保它在 CTRL + SHIFT时使用 goimports + F


According to this post autoimport could be enabled in GoClipse:

1) install goimports:
go get code.google.com/p/go.tools/cmd/goimports

2) in eclipse goto: Preferences -> Go -> Go Formatter and set it to be the path of the goimports bin

This will fix all imports when you format. If you combine this with #67, then imports will be automatically fixed on save.

Problem

When I try to search for Go Formatter in Eclipse I cannot find it.

解决方案

One thing that my eyes caught out:

I know that goimports URL is no longer google.com/p/go.tools/cmd/goimports.

So lets try the following:

  1. Execute go get golang.org/x/tools/cmd/goimports
  2. Go to Preferences -> Go
  3. Set gofmt to ${GOPATH}/bin/goimports (which is where goimports is located)
  4. Restart Eclipse and make sure it uses goimports when CTRL+SHIFT+F is pressed.

这篇关于如何在GoClipse中启用自动导入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆