One of the sweeter things in go is most definitely deployment! Gone are the annoyances of setting up a server with the right version of Ruby (probably having to compile the right version as the Debian packages are often behind) installing all the gems you require and having to manage a git repository/keys.

Since Go is a compiled language you have a couple of options for deploying your Go app once compiled. You can either send the binary up via sftp or similar, along with your assets (templates/css etc) or you can package your app into a Debian package like we do here.

Compiling your app may be a little trickier if you're on OSX but want to run your app on Debian in production. The Go compiler does come with built in cross compiling but be aware that you can't use this approach when you're using C extensions in Go. That's where Docker comes in! (Docker is also written in Go!) The Go team even have a blog post about the subject.

Something to also be aware of is the GOMAXPROCS variable, letting you run goroutines in parallel. I recommend watching this video about Go and concurrency. Note that if you're on a machine with a single processor then this has no effect since all goroutines will run on the same processor anyway. To achieve true parallelism you will need multiple cores. You might wonder why the Go scheduler doesn't automatically detect how many cores a machine has? It's coming soon when the scheduler has improved.

If you've ever deployed a monster Rails app before then a couple of seconds of compiling and quickly uploading a binary will seem like a dream.

How are you deploying Go? Let me know on Twitter or HN.

Alex Barlow

Alex Barlow

I like programming in Hipster languages

@alexrbarlow

Continue reading

Technology

How we do CSS at Made by Many

This write-up aims to summarise our thinking about how to write CSS. It’s grown out of lots of conversations around best practices seen elsewhere, and ult...

Callum Jefferies   ·   29 May 2015

Design

The 20 things you should know when designing for classrooms

Download the accompanying report at the end of this post to discover more about co-designing education services with teachers.Collaboratively designing wi...

Veronika Janeckova   ·   11 May 2015

Position closed: What the hell’s an embedded storyteller and why are we hiring one?

Made by Many is trying to hire an ‘in-house journalist’. The inverted commas are my apology for the horrible term, but job titles are hard. Why are we hir...

Andy Whitlock   ·   7 May 2015