Go语言配置

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

Go language configuring

问题

我需要为我的大学做一个项目,我选择使用Go语言来完成。昨天我安装了.msi文件并设置了以下变量:

  • GOPATH = C:\Users\Gustavo\goprojects(这是我想要放置所有Go项目的文件夹)
  • GOROOT = C:\Go\
  • PATH = C:\Users\Gustavo\goprojects\bin

在这之后,我在Eclipse上安装了GoClipse插件,并在goprojects文件夹中创建了一个新项目。然后,我在src文件夹中创建了另一个文件夹,并在该文件夹中创建了一个.go文件。

现在出现了问题。每当我开始编写一些代码时,每次尝试自动补全代码时,Eclipse都会显示一个错误。我在Google上搜索并发现我需要从GitHub上安装一个名为gocode的项目。

所以我想知道我需要在哪里安装它,以及如何将其导入到我的项目中。

附注:我正在使用Windows 8.1,我已经安装了git,并且gocode项目的链接是:https://github.com/nsf/gocode

英文:

I need to do a work for my university and I choose to do it using the Go language. Yesterday I installed the .msi and setted the variables to:

  • GOPATH = C:\Users\Gustavo\goprojects (this is the folder that I want to place all my Go projects)
  • GOROOT = C:\Go\
  • PATH = C:\Users\Gustavo\goprojects\bin

After this, I installed the GoClipse plugin on my Eclipse and created a new project into the goprojects folder. Then, I created another folder in the src folder, and a .go file into this folder.

Now is my problem. When I started to write some code, everytime that I try to auto complete my code, Eclipse shows me an error and I was searching on google and found that I need to install one project from GitHub called gocode.

So I want to know where do I need to install it and how can I import it to my project.

P.S.: I am using Windows 8.1, I have git installed and the link of gocode project is: https://github.com/nsf/gocode

答案1

得分: 1

我通过以下步骤解决了我的问题:

  • 下载了 gocodesrc 文件夹中(路径:C:\Users\Gustavo\goprojects\src\github.com\nsf\gocode)。
  • 在 Eclipse 中,依次选择:Window -> Preferences。
  • 在左侧菜单中选择 Go 选项,然后点击 Tools。
  • 在 gocode 路径中设置为 C:\Users\Gustavo\goprojects\bin\gocode.exe

就是这样!现在它可以正常工作了。

英文:

I solved my problem doing this steps:

  • Downloaded the gocode to the src folder. (The path: C:\Users\Gustavo\goprojects\src\github.com\nsf\gocode)
  • In the Eclipse, do this: Window -> Preferences.
  • Open Go option in the left menu then click Tools.
  • In the gocode path I set C:\Users\Gustavo\goprojects\bin\gocode.exe

And thats it! It works now.

huangapple
  • 本文由 发表于 2015年10月1日 05:57:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/32876283.html
匿名

发表评论

匿名网友

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

确定