Coding with Go

The mascot of GO is a little freaky creature!!!

So I have just reinstalled my Windows 8.1 system and was beginning to do some testing of Python and I stumbled on the Go language.  It

has been a while since something has tweaked my curiosity so.

And here for my benefit and those of you who would also like the full experience is a short tutorial of how to get started.

First off, download the git installer for Windows, it is useful for getting access to the source code with Go and is a must have on a cleanly installed machine.  Make sure you install the run git from the command line option for the best results.

http://git-scm.com/download/win

Secondly you should get hold of the GCC compiler, in order to do the more advanced stuff with Go you need a compiler. I struggled a bit with this one as I seemed to only get to download source code at first.

http://ufpr.dl.sourceforge.net/project/mingwbuilds/mingw-builds-install/mingw-builds-install.exe

The builds installer sorted that for me, make sure you choose the correct options for your windows installation, if you are not sure choose the win32 option.  I also chose where I wanted to install my compiler so that I could add it to my PATH variable in windows.

The Go installer worked quite easily and I only had to add a variable for the GOPATH in my environment variables which in my case pointed to c:\Go\bin

http://go.googlecode.com/files/go1.2.1.windows-amd64.msi

The next bit was easy, create a go file helloworld.go and write your first bit of code for the hello world example:

package main
import “fmt”
func main() {
fmt.Println(“hello world!”)
}

And then going to commandline and running it with:

go run helloworld.go

That’s it for now, enjoy the coding!

 

 

 

 

 

Leave a Reply

Your email address will not be published.