如果开发人员开始编写 Go 代码,因为 GoClipse 缺乏主要功能,他们是否应该用另一个 IDE 替换 Eclipse?

Should developers replace Eclipse by another IDE if they start coding Go as GoClipse lacks major features?

最近团队中发生了语言转换。该团队使用 Eclipse 作为 IDE 几年了。完成的第一件事是 installing the GoClipse plugin in Eclipse,但几个小时后,一些开发人员决定退出 Eclipse。其中一位说:

GoClipse lacks major features, like autocomplete, navigating to functions and autoimport.

目标: 提供如何配置这些功能的完整指南,以便开发人员继续使用 GoClipse 而不是用另一个 IDE

问题

问题 1

CTRL+LMB 结果:


问题2

自动完成,例如输入 fmt. 结果:


问题3

总结

开发人员没有理由替换 GoClipse,因为 GoClipse 的主要功能也适用

答案

回答 1

要启用导航,即 CTRL+LMB,请按照说明操作,即发出 go get -u golang.org/x/tools/cmd/oracle 然后单击 浏览 和select oracle 二进制文件所在的路径。注意:如果 export GOPATH=/path/to/workspace 则二进制文件驻留在项目的 bin 目录中。


回答2

要启用自动完成问题 go get -u github.com/nsf/gocode,单击 浏览 和 select gocode 二进制文件(参见答案 1)


启用自动导入问题 go get golang.org/x/tools/cmd/goimports 并将 goimports 的路径添加到 gofmt 字段。

Installation guide 的第 7 步显示:

"For initial setup, follow the instructions at the configuration section in the User Guide."

事实上,configuration section 解释了您需要哪些其他外部程序(例如 gocode 和 oracle),以及如何配置它们。