Product Engineering

Go Programming Language: Key Features

Go Programming

The Programming Language space is a crowded one and it is not an easy job to emerge as the language of choice by any measure. One language that has taken a while to come out of the blocks and is now seeing a clear traction in the infrastructure space is Google’s Go Programming Language.

The Go Programming Language was started at Google by Robert Griesemer, Rob Pike and Ken Thompson in 2007, with its first release in 2009. The core reason behind creating a new language then was to help manage large code bases, keep the development productive and focus on simplicity. With its roots across multiple programming languages and especially that of C language, it found its followers slowly and steadily. The Go Project is not just the language specification but also a toolchain and an ecosystem that consists of standard libraries and external 3rd party libraries contributed by organizations and individuals.

Now 6 years later, it is currently at 1.6 version with 1.7 about to be released in mid-February. Along the way it has become the preferred language of choice for Infrastructure vendors with some of the most popular and active projects being written entirely in Go Language. Docker, the Container startup, that has revolutionized the way we build, ship and run applications is completely written in Go Language. Some of the other big users of the language include CoreOS, Kubernetes (Google), InfluxDB and more.

What are some of the reasons behind the popularity of Go? Why do developers feel that it makes programming fun again? Here are some of the key points:

Binaries:

Go generates binaries for your applications with all the dependencies built-in. This removes the need for you to install runtimes that are necessary for running your application. This eases the task of deploying applications and providing necessary updates across thousands of installations. With its support for multiple OS and processor architectures, this is a big win for the language.

Language Design:

The designers of the language made a conscious decision to keep the language simple and easy to understand. The entire specification is in a small number of pages and some interesting design decisions were made vis-à-vis Object-Oriented support in the language, that keeps the features limited. Towards this, the language is opinionated and recommends an idiomatic way of achieving things. It prefers Composition over Inheritance and its Type System is elegant and allows for behavior to be added without tight coupling the components too much. In Go Language, “Do More with Less” is the mantra.

Powerful standard library:

Go comes with a powerful standard library, distributed as packages. This library caters to most components, libraries that developers have come to expect from 3rd party packages when it comes to other languages. A look at the Packages available in the standard library is good enough indication of the power available in them.

Package Management:

Go combines modern day developer workflow of working with Open Source projects and includes that in the way it manages external packages. Support is provided directly in the tooling to get external packages and publish your own packages in a set of easy commands.

Static Typing:

Go is a statically typed language and the compiler works hard to ensure that the code is not just able to compile correctly but other type conversions and compatibility are taken care of. This can avoid the problems that one faces in dynamically typed languages, where you discover the issues only when the code is executed.

Concurrency Support:

One area where the language shines is its first-class support for Concurrency in the language itself. If you have programming concurrency in other languages, you understand that it is quite complex to do so. Go Concurrency primitives via go routines and channels makes concurrent programming easy. Its ability to take advantage of multi-core processor architectures and efficient memory is one of the reasons while Go code is today running some of the most heavily used applications that are able to scale.

Testing Support:

Go Language brings Unit Testing right into the language itself. It provides a simple mechanism to write your unit tests in parallel with your code. The tooling also provides support to understand code coverage by your tests, benchmarking tests and writing example code that is used in generating your code documentation.

Go has seen significant adoption from large projects and due to its tooling, ecosystem and language design, programmers are steadily moving towards it, especially while building out infrastructure pieces. We expect that its popularity will continue to rise. Getting started with Go is straightforward and the Go Programming Language Home page has everything from installing the toolchain to learning about Go.