Google’s Go Programming Language: Taking Cloud Development By Storm


Matt Asay

March 21, 2014

What do popular projects like Docker, Heroku's and Cloud Foundry's (Go)Router all have in common? They're all written in Go (a.k.a. "golang"), Google's five-year-old programming language.

While languages like Java continue to dominate programming, new models have emerged that are better suited to modern computing, particularly in the cloud. Go, written expressly for the cloud, has been growing in popularity because of its mastery of concurrent operations and the beauty of its construction. 

Cool With The Cool Kids

Google's mascot for its Go programming language.

Google's mascot for its Go programming language.

By some measures, Google's Go programming language is a non-factor in development. Google Trends, which measures general interest in a search term, hardly registers a blip for Go compared to more established programming languages like Java, C++ and JavaScript.

But this doesn't tell the whole story. While it's basically impossible to figure out the number of jobs requiring Go skills, due to its generic name, there are a number of sources (see herehere and here) that suggest Go is gaining momentum as an important programming language for employers.

The best leading indicator of Go adoption, however, is its rise in open source development.

According to Redmonk analyst Donnie Berkholz's analysis of Ohloh, which tracks 600,000 open source projects, Go adoption is real and growing:

While nearly 1% of Ohloh-tracked projects may seem small, Berkholz puts it in context:

Go is rapidly closing in on 1% of total commits and half a percent of projects and contributors. While the trend is obviously interesting, at first glance numbers well under one percent look inconsequential relative to overall adoption. To provide some context, however, each of the most popular languages on Ohloh (C, C++, Java, JavaScript) only constitutes ~10% of commits and ~5% of projects and contributors. That means Go, a seemingly very minor player, is already used nearly one tenth as much in FOSS [free and open-source software] as the most popular languages in existence.

This means, of course, that Go is becoming a really big deal, especially if we consider the outsized importance of some of its most visible projects on GitHub, like Docker.

Why Go For Go?

Google's Go language is, not surprisingly, particularly well-suited to cloud development. But according to Rob Pike, one of Go's designers, Go's creators were originally trying to improve C++ but found it "too difficult to couple [necessary] concurrent operations with C++'s control structures, and in turn that made it too hard to see the real advantages." Eventually he gave it up because "C++ just made it all seem too cumbersome."

Go succeeds in part because it makes code composition elegant and easy, as Pike continues: 

Go isn't all-encompassing. You don't get everything built in. You don't have precise control of every nuance of execution. For instance, you don't have RAII. Instead you get a garbage collector. You don't even get a memory-freeing function.
What you're given is a set of powerful but easy to understand, easy to use building blocks from which you can assemble—compose—a solution to your problem. It might not end up quite as fast or as sophisticated or as ideologically motivated as the solution you'd write in some of those other languages, but it'll almost certainly be easier to write, easier to read, easier to understand, easier to maintain, and maybe safer.

The other big reason developers turn to Go has everything to do with concurrent operations, or the ability to execute multiple processes at the same time. As one developer notes, Go is particularly strong for concurrency:

The issue for PHP and even Node.js is obviously you're trapped in a single-threaded situation and what I really wanted was to be able to do a lot of things concurrently. My options were to go with something like Java, where you have more memory overhead, or I could go with something like Go that was built from the ground up for concurrency and using very modern patterns.

Go also delivers concurrency with the "static execution speed of C or C++" and with "a more compositional feel, a script kind of feel." Ultimately, developers fall in love with "the beauty of the language" itself, which is quite a compliment.

For its part, Google touts the benefits of Go in this way:

  • It is possible to compile a large Go program in a few seconds on a single computer.
  • Go provides a model for software construction that makes dependency analysis easy and avoids much of the overhead of C-style include files and libraries.
  • Go's type system has no hierarchy, so no time is spent defining the relationships between types. Also, although Go has static types the language attempts to make types feel lighter weight than in typical OO languages.
  • Go is fully garbage-collected and provides fundamental support for concurrent execution and communication.
  • By its design, Go proposes an approach for the construction of system software on multicore machines.

A Modern Programming Language For Modern Development

Whether it's about easy composition or easy concurrency, developers seem to prefer Google Go because it was written for the cloud, and that seems to be where the future is headed.

As Berkholz concludes, "Tooling that can ease the complexity for both new entrants and existing users of the cloud will continue to gain prominence at all levels of the stack." This is true for Go, and suggests it has a bright future at the center of cloud development. 

Lead image courtesy of Shutterstock; right image by Google

Great ! Thanks for your subscription !

You will soon receive the first Content Loop Newsletter