Learn Go Now, Thank Me Later

A Brief Look Into The Benefits Of Go


The programming language Go started in 2007 as an internal project at Google. Since then Go has developed a growing community online and amongst startups. There are already some awesome products built with Go such as Docker, Sendgrid, and Clever just to name a few. Those who have switched from more traditional languages such as PHP, JavaScript, and Python have seen noticeable improvements in performance, usability, and development workflow (myself included).

“So what are some reasons why I should pick up Go?”

There are many reasons why one would use Go for an application, so I will try to touch on some I have found useful.

Performance

Go’s relatively small memory footprint allows it to be very fast. This is accomplished in part by the use of compact data structures that take advantage of cache to reduce access time. Compact data structures leads to better performance. Go’s compiler also adds to its speed. Using techniques such as its approach to inline compiling allows for minimal work needed for function calls that may have less than desirable overhead. Go also uses escape analysis to intelligently handle garbage collection. What all these fancy techniques mean is that Go is optimized for performance.

Open Source & Well Documented

This has been a big part in helping the community grow. The combined help of the open source community and the internal Google team have already accomplished a lot with still much room for improvements. The community is not as large as those around other languages such as Python or PHP, but has a thriving community nonetheless. Though the community is smaller, the documentation available is great updated frequently.

Formatting Made Easy

With the help of Go fmt, and other plugins that can be used with emacs, vim, etc, one’s code can be auto formatted. This is great for lightening the stress of those trying to understand another developer’s code. This alongside a habit of good coding practices makes team development that much easier.

Awesome Standard Library

One of the biggest benefits of Go is it’s built in implementation of concurrency with the help of goroutines and channels which means you don’t have to build this from scratch! Go’s built in concurrency primitives make it an attractive choice for developers who are used to single threaded languages. Another good (not great yet) standard library is Go’s testing framework. There are more advanced testing packages available that have added functionality. You can check out the entire standard library and see if there is anything that interests you.

Strict (But Awesome) Compiler

Go has a very strict compiler that limits unused code by preventing unused packages and variables in a successfully built binary. This may seem like a (very small) hurdle when testing, but the benefits of having cleaner and better performing code outweigh the temporary inconvenience of having to temporarily comment out code for testing purposes. A successfully built Go program is compiled statically down to a single binary file that can be run without any external dependencies. All you need to do is run the “Go run” command and you’re off!

Built in Package Manager

Package management is a breeze with the “Go get” command, which is used to add a new package’s source code so you can import the package into your project. This system makes it dead simple to add new packages and even create your own that can be used just for your project(s) or for uploading to GitHub for others to use.

“Go can’t be perfect… what’s the catch?”

Object Oriented, but not Object Oriented

Go does contain properties of an object oriented language, but does lack some, which simply requires a slight change in thought process to understand the changes. For example, Go does not have true inheritance, but you can embed a struct into another struct; Namespacing is accomplished via exports; Polymorphism is (kinda) accomplished via interfaces.

Time/Money Cost To Switch

Companies who want to use Go have to take into consideration the time/cost that comes with either switching developers to Go, or finding Go Developers in a day and age where Go Developers are not very easy to find. Depending on the size of the company, this may not be an ideal situation without pushing back a lot of current progress and momentum.

Lack of generics and other random stuff

At the moment Go does not support generic types, but that is not to say that it will not be added in the future. There are also a few other things (at the time this post was written) that are not included in Go such as exceptions, assertions, and threads but Go does have Goroutines. You can make suggested improvements to the language, but good luck getting them accepted.

TL;DR

Give Go a try! It is fast, effective, open source, and only getting better from here. If you want help getting going you can sign up for a class in person or online!