Ubuntu, Eclipse, Golang, Gocode Tutorial

You want to program Golang but having a hard time working on Eclipse to get it working?

Here is a simple speedorial:

1 Eclipse

2 Eclipse Go Settings

  • Go to Window-> Preferences
  • Select Go
  • GOROOT: /usr/lib/go
    GOPATH: /usr/share/go
    Go-tool path: /usr/bin/go
    Go formatter: /usr/bin/gofmt
    Go documentor: /usr/bin/godoc

3 GoCode for Autocompletion

  • Make sure you have git installed: sudo apt-get install git
  • Get gocode with: sudo go get -u github.com/nsf/gocode
  • In Eclipse go to Window-> Preferences
  • Select Go-> Gocode (Submenu)
  • Gocode path: /usr/lib/go/bin/gocode

Kinda shitty written, but this might/maybe/hopefully get you going with autocompletion and everything :)

Function that creates a function and returns that function

Golang find smallest number in array

Well, it works.