Getting started with Go

I spent some time learning the Go programming language by working through some tutorials and building a small app. The book An Introduction To Programming in Go has 14 chapters and covers data structures, HTTP, command line apps, concurrency, and more.

Project layout

I typed out most of the go example code for practice and have pushed my code here. Go has specific project layout requirements. The GOPATH environment variable points at ~/go and project source code is in src as a subdirectory of ~/go. For more information refer to go help gopath.


To learn Go better, I made a small web app and deployed it to Heroku. This forced me to figure out how to handle form posts, redirects, the MD5 library, and work with a database.

The Heroku part started off easy thanks to this guide. However Heroku deploys failed for me with third-party dependencies like pq, using godep. I wasn't able to get godep working, but I was able to use gopack for the same purpose instead.


Gournay is a simple web app that shrinks URLs, written in Go. The source is on github and the app is deployed at Gournay depends on the pq package to connect to a postgres database, and uses godep to manage its dependencies.

Gournay takes a long url like and makes a short hash from it. The URL and hash are stored in a database table. If the hash is posted back at gournay, the user is redirected to the original URL.


I am enjoying learning Go so far, and have plans to spend more time learning the concurrency features. If you have any other tips on Go, or found this useful, please leave a comment.