A Rails Programmer's Journey into Go (so far)

You might have heard discussion about a programming language called Go (or #golang on Twitter). It was invented by some noteworthy Google staffers 4 years ago to solve large-scale server side development problems, i.e.:

  • monolithic bloaty code
  • long-compilation & test times
  • varying code styles across different teams
  • concurrency is hard
  • needing C/C++ to write high-performance code
  • dependency management slows down deployment

Hold on... What is Go?

Go is

  • statically-typed compiled like C/C++
  • somewhat Object-Oriented(tm)
  • minimalist compared to Ruby, Java or Scala
  • lightening fast if you're coming from a dynamic language like Ruby or Python
  • supported by great out-of-the-box tooling (compiler, test runner, syntax formatter, race condition checker, profiler)
  • provided with an amazing standard library to solve 21st century problems
  • concurrency is core part of the language
  • compiled to single static binary: copy-to-deploy.

Most importantly, Go is easy and quick to learn. It took me two weekends of hacking plus midweek reading to grok it, incl. the concurrency.

So how do I get started?

There's a whole bunch of good videos out there. Below is a list that I'd suggest you watch in the order listed to give you a taste of the language

Go: a simple programming environment

http://www.youtube.com/watch?v=UgzIApJdLwY
Good overview of Go and its tooling

 

A Tour of Go

http://www.youtube.com/watch?v=ytEkHepK08c
Great explanation of Go's concept of OO and interfaces.

 

Go Concurrency Patterns

http://www.youtube.com/watch?v=gfMOD7tZAw4

Concurrency done easy. If you've ever done concurrency, this video will blow you away.

 

Go after 2yrs in Production

http://www.youtube.com/watch?v=Pw07q3e4jEY
Impact of switching to Go on performance and cost savings.

OK, I'm convinced I want to get started...

Time to get your hands dirty... and take the interactive web-based tour at tour.golang.org

Once you're bored with the tour and you want to start coding for real, follow these guides

  1. Install Go
  2. How to Write Go code
  3. Effective Go

That last link (Effective Go) will be your constant companion - bookmark it :-).

Should I buy Go book?

Don't bother, the online material is far better than any books you'll find on Amazon.

What should my first project be?

Try building some client-side libraries to a popular Web API service. This will let you play with different parts of Go and its standard library (go routines, http, JSON marshalling).

I'm super-hardcore and I like to TDD my code?

Use GoConvey, the best test runner on the planet.
http://www.youtube.com/watch?v=vL_UD1oAF0E

 

Does Go have a Rails-like web framework?

No, but it has an excellent Sinatra-like framework. Check this blogpost on Go web programming.

http://vimeo.com/79487342