将GoClipse正常与普通的GO工作区配合使用

huangapple go评论89阅读模式
英文:

Getting GoClipse to work normally with a normal GO workspace

问题

我一直在尝试在Linux(CentOS6.6)上使用Eclipse(4.4.2)和GoClipse(0.8.1v2001409161333 - 最新版本来自goclipse_feature.feature.group)与通过yum从EPEL安装的GO(1.4.2-2.el6),但只实现了部分功能。

对于内置包,智能感知似乎工作正常,但是GoClipse似乎对其目录结构进行了一些奇怪的处理,与正常的GO工作区布局不同。现有的源代码控制结构如下:

$GOPATH/bin/...
$GOPATH/pkg/...
$GOPATH/src/externalsite/module/version/*.go
$GOPATH/src/externalsite/module/version/subdir/*.go
$GOPATH/src/me/module/*.go
$GOPATH/src/me/module/feature/*.go

当我尝试使用GoClipse时,它总是坚持认为*.go文件必须与bin|pkg|src目录同级。这意味着我要么将*.go文件放在$GOPATH下,要么告诉GoClipse main.go的位置($GOPATH/src/me/module/main.go),然后GoClipse会再次创建bin|pkg|src目录:

$GOPATH/src/me/module/bin/
$GOPATH/src/me/module/pkg/
$GOPATH/src/me/module/src/

我的GoClipse配置已经适当地设置了$GOPATH(我尝试过未定义$GOROOT或将其设置为yum安装位置,但没有效果),并且在从现有代码创建Go项目时,将位置指定为$GOPATH/src/me/module/(手动展开$GOPATH)。

我找到的一些资源似乎没有提供任何关于让GoClipse遵守正确的go工作区结构的建议,我希望有人能告诉我如何做到这一点。
以下资源可能会有所帮助,但它们没有解决这个困难:
https://stackoverflow.com/questions/27477855/how-to-run-a-go-project-in-eclipse-with-goclipse-installed
https://github.com/GoClipse/goclipse

英文:

I have been trying to use GoClipse (0.8.1v2001409161333 - latest available from the goclipse_feature.feature.group) with Eclipse (4.4.2) on Linux (CentOS6.6) with GO (1.4.2-2.el6) installed via yum from EPEL and have only achieved partial functionality.

Intellisense appears to work fine for the built in packages but GoClipse appears to do something weird with it's directory structure that is different from the normal GO workspace layout. The existing structure under source control looks like:
$GOPATH/bin/...
$GOPATH/pkg/...
$GOPATH/src/externalsite/module/version/*.go
$GOPATH/src/externalsite/module/version/subdir/*.go
$GOPATH/src/me/module/*.go
$GOPATH/src/me/module/feature/*.go

When I try and use GoClipse it always appears to insist that the *.go files must be a peer of the bin|pkg|src directories. This means that I either have my *.go files at $GOPATH or tell GoClipse where main.go is ($GOPATH/src/me/module/main.go) and GoClipse creates the bin|pkg|src directories again:
$GOPATH/src/me/module/bin/
$GOPATH/src/me/module/pkg/
$GOPATH/src/me/module/src/

My GoClipse configuration has $GOPATH set appropriately (I have tried with $GOROOT undefined or set to the yum install location to no effect) and when creating the Go project from existing code specifying the location as $GOPATH/src/me/module/ (manually expanding $GOPATH)

Some resources that I have located do not appear to offer any advice on getting GoClipse to respect the proper go workspace structure and I am hoping someone can tell me how to do this.
The following resources might be of interest but they do not solve this difficulty:
https://stackoverflow.com/questions/27477855/how-to-run-a-go-project-in-eclipse-with-goclipse-installed
https://github.com/GoClipse/goclipse

答案1

得分: 2

确实,goclipse.github.io/releases 是最新的更新站点URL,所以你应该使用最新版本(该URL在过去一年中发生了多次更改)。自0.8.0以来,Goclipse处理Go环境的方式发生了重大变化,特别是在0.9.0中,它允许在GOPATH的'src'条目内的文件夹中创建一个Eclipse项目(并且其他情况处理得更好,特别是构建器)。

注意:更新后,您需要重新创建Eclipse Go项目(0.10.0进行了一些内部的、不向后兼容的更改)。

您可能希望查阅更多详细信息,请参阅更改日志:https://github.com/GoClipse/goclipse/releases

英文:

Indeed, goclipse.github.io/releases is the latest update site URL, so you should use the latest version (the URL did change several times since in the span of the previous year). The way Goclipse handles the Go enviroment has changed significantly since 0.8.0, particularly with 0.9.0, which allows creating an Eclipse project on a folder inside a GOPATH 'src' entry. (and other cases are handled better, especially with the builder).

Note: you will need to recreate your Eclipse Go projects after updating (0.10.0 had some internal, non backward-compatible changes).

You might want to consult the changelog for more details: https://github.com/GoClipse/goclipse/releases

huangapple
  • 本文由 发表于 2015年5月18日 19:09:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/30301633.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定