To get started I took a look through https://golang.org and skimmed through the documentation. There is a neat getting started guide and a built in editor where you can insert and run code written in Go.
I use Eclipse all the time and find it comfortable to use so I decided to set up Go in Eclipse.
Step 1: I Downloaded the Go binaries from golang.org and installed them, by default the go into C:\Go which suits me fine.
Step 2: To get Go working in the command line you need to add it to your windows path, so I hit the windows key, typed computer, right clicked on this PC and opened Advanced System Settings. Under environment variables I added C:\Go\bin to my path.
I also added a GOPATH variable, this is an empty folder go will use to hold any downloads etc. you get by invoking the go get command.
Step 3: I opened Eclipse and added an update site "Go - http://goclipse.github.io/releases/" and filtered for Goclipse and installed it.
I created the a folder called main inside the src folder and created a go file called main inside of that.
I then pasted some code in and hit the run button and I my application started.
Gotchas:
Code completion didn't work because of the following error:
Reason: Cannot run program "gocode": error=2, No such file or directory
To fix this I ran the following command:go get -u github.com/nsf/gocode
Then in Eclipse under Window > Preferences > Go > Tools I set the gocode path to where I downloaded the gocode binaries.
No comments:
Post a Comment