Friday, April 22, 2011

Setting up development environment for Go on windows

A simple tutorial to set up a development environment for the Google's Go programming language on windows.

Firstly, download Go windows installer here. Then install after downloading.

Secondly, launch eclipse (you can get it from here if you don't have it installed already). Goto Help -> Install New Software and add this link "http://goclipse.googlecode.com/svn/trunk/goclipse-update-site/". Then install the plugin.


With this goclipse plugin is installed. Next is to configure the plugin. Goto Windows -> Preferences -> Go

Finally, lets write hello world.

Create a new go project




Create  a source file and write hello world.






Lets run our project. In case there is an error message, right-click on main.go -> Run As -> Go Application.



Lets use packages

Other packages apart from main package should be created under pkg


 Name the package "my" and create a file add.go under it with the following contents


Now lets go back to main.go and change its contents to this

Finally, lets run our project. If every goes well, we should see this output