I like Eclipse and I used it for many years on Linux for Java developement. I wanted to test how go(golang) works but I did not like all the suggested IDEs, you know the “cool” ones.
I wanted to be able to use Eclipse. By default eclipse is not go oriented but with some small changes is the perfect development environment for go.
STEP 1: Install go (golang)
On Fedora Linux just do:
dnf install golang
STEP 2: Install Eclipse plugin “goclipse”
There is a nice plugin that adds go support to Eclipse. You just have to add as a new plugin source “http://goclipse.github.io/releases” and select from available software GoClipse
STEP 3: Install go tools
There are several nice go tools that are supported by GoClipse and very useful.
Gocode: An auto completion daemon for the Go programming language
$go get -u github.com/nsf/gocode
Godef: prints the source location of definitions in Go programs.
$go get -u github.com/rogpeppe/godef
Guru: A tool for answering questions about Go source code.
$go get -u golang.org/x/tools/cmd/guru
– add to gopath your home go directory (:/home/gvoina/go)
– set installation directory where go is installed (/usr)
STEP 4: Set gopath and go installation in Eclipse
STEP 5: Set go tools in Eclipse
Set the path of the above go tools in Window->Preferences->Go->Tools
STEP 6: Create a new go Project
Now a new option is available File->New->Go Project
As a result a new go project together with a hierarchy of directories and a specific go view are created.
STEP 7: Create a test application
Under src create a directory for your first go program and a test go file:
STEP 8: Create a run configuration
Create a run configuration for the test go program. Make sure to add the package containing the main function to “Go package to build”