Following Google’s public release of their new programming language, Google ‘Go‘ myself and Daniel, Technical Director here at web hosting firm 34SP.com, decided that it would not only be cool to do a little research into this new language, but also to share that research with our customers by setting-up a brand new VPS template, pre-installed with Go, ready for rapid development testing!
To make use of the new VPS template, you’ll need to purchase a new VPS (of any size) and select your Operating System as ‘Go Development’. Note that you will have to select ‘0’ under ‘Plesk Licenses’ before you’re able to change the Operating System – we cannot currently provide this template in conjunction with Plesk licenses.
The Go Development VPS template is currently built upon a 64-bit image of Ubuntu Server 9.04, using the latest (as of Friday 12th of November) build of Go and includes a sample ‘Hello World’ script in the /root directory, ready to build.
To get you started, the following instructions should allow you to compile & run your very first application with Go. Once you’ve received the welcome e-mail for your Go Development VPS, login via SSH with the login details included and run:
root@gotest:~# 6g hello.go
This uses the AMD64 (64-bit) compiler to compile the file ‘hello.go’, a simple “Hello world” example. You then need to link the output by running:
root@gotest:~# 6l hello.6
Following the successful linking of your program, you should then have a executable binary file named ‘6.out’. You can run now run this by typing:
If you see the same output, ‘hello, world’; it’s working! You’re now free to explore the world of Google Go and begin creating your very own .go files for compilation.
Of course, Google Go is still under considerable development. Those of you wishing to continue your testing and development with the latest improvements to Go, will soon wish to update and re-compile their Go installation. The following instructions should help you achieve this goal.
First, change to the Go root directory, located at /root/go:
Then pull the latest source code from the Google Go Mercurial repository:
root@gotest:~/go# hg pull -u
pulling from https://go.googlecode.com/hg/
searching for changes
adding file changes
added 49 changesets with 110 changes to 66 files
76 files updated, 0 files merged, 1 files removed, 0 files unresolved
Once updated, change into the Go ‘source’ directory:
root@gotest:~/go# cd src/
And then simply run the build script, as follows:
Upon running this script, the compiler will begin updating your installation of Go – this will take a short while and produce plenty of output. If for any reason this fails, please copy the last 10-20 lines of the output into an e-mail, and fire it off to email@example.com, explaining the steps that you took to achieve this output.
Of course, any bleeding-edge development code can often fail to build, therefore we can only offer advice on how to remedy build problems with Go – we cannot support the debugging of the Go source code in-house.
As ever, here at 34SP.com we’re eager to hear about any feedback from our customers and Go development with our VPS products is no exception. Enjoy!