How to implement CI/CD in just six weeks
Close

17 September 2021

Software Development

The Go programming language—everything you should know

16 minutes reading

The Go programming language has been known to the developer community for a few years, but can definitely still astonish. Not without reason, it successfully keeps its position in the top 10 most loved languages. More than 80,000 developers have shared their opinions. Golang gets almost 63% of their votes for “loved”. We can’t imagine a better recommendation, but we prepared this overview anyway to provide you, in my opinion, with the most important information about the Go programming language.

A short history of the Go language

The story of the Go programming language started at Google, when three engineers, Robert Griesemer, Rob Pike, and Ken Thompson grew weary of C++’s complexity, and the lack of a simple language providing efficient compilation and execution. That’s why on September 21, 2007, they started designing a new language. It took them two years before, on November 10, 2009, the Go programming language became a public open source project. After three more years, in March 2012, version 1.0 of the Go language was released. 

The Go inventors’ main goal was to combine the ease of programming from an interpreted, dynamically-typed language with the efficiency and safety coming from a statically-typed, compiled language. Moreover, the Go language was intended to support network and multicore computing, and to accelerate the coding process. 

To achieve these goals, Griesemer, Pike, and Thompson focused on simplicity. That’s why the Go language’s syntax is inspired by the C family. Other input, e.g. from Pascal, you can notice in the declarations and packages. The other inspirations were Newsqueak and Limbo - they helped create the concurrency aspect of Go. That makes this programming language a mix of the best features of these various solutions. 

Is it called Golang or Go? We answer

The Go programming language is often called Golang. Why is that? The reason is simple - the domain “go.org” wasn’t available back then, so programmers decided to launch a golang.org (a mix of Go and language). So, the official language name is Go, but the official Twitter tag is #golang.  

What is Go language?

Keeping everything mentioned above in mind, Robert Griesemer, Rob Pike, and Ken Thompson made Go a compiled, concurrent, garbage-collected, statically-typed language. They wanted to make the most effective language for the community, from programmers who know programming inside out.  

Why is Go so popular? 

Despite being twelve years old, Go is still gaining popularity, an often-used programming language thanks to its unique advantages served up in one convenient package. What also made Go popular is the fact that Go is a general-purpose language (GPL) directed at creating backends. At the Strange Loop conference in 2012, Andrew Gerrand introduced Go as the “code that grows with grace”. Some of Golang’s strengths (listed below) prove that this quotation is still up-to-date. 

Go Proverbs is a list of strong quotations about the essence of Go. Rob Pike said  “Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.” Even if, especially at the beginning, you aren’t happy with the necessity to use braces, etc., in the end, you’ll appreciate gofmt. Only one standard is in operation - not various conventions as in most programming languages. Gofmt as a dedicated tool is something outstanding on the market and it is a real help in maintaining cohesion.

Simplicity of code

Go’s syntax is relatively small, and has stayed more or less the same without any big changes. What’s more, there is only one standard code format (generated by the fmt tool). The lack of changes in the Go syntax also helps developers. It stays almost the same, so the code isn’t overcomplicated, and there is no necessity to learn new paradigms or syntax. That makes it transparent, and easy to learn and understand. All this can be reduced to one statement from the Go creators: the promise of compatibility. If you use a new version of Go, almost all programs written in the older versions of the programming language will still compile and run without requiring any changes. That makes it really easy to maintain.

Extensive programming tools 

As an open source project, Go provides easy access to the needed development tools. There is a wide range of:

  • IDEs:

    • GoLand from JetBrains is a cross-platform IDE with features like on-the-fly error detection with suggestions for fixes, refactorings with one-step undo, intelligent code completion, dead code detection, documentation hints, and git integration, etc.
    • GoClipse - Eclipse IDE with Go programming language support. 
    • LiteIDE - this open source and cross-platform solution includes configurable build commands, code editor and management, and extensive Go support. 
    • Zeus IDE is an IDE for the Windows platform, making developers’ work easier thanks to gocode for auto-complete, documentation, and code navigation, as well as tools like gofmt and goimports for automatic code formatting. 
  • editors:

    • VSCode - a code editor with extensive Go support providing, for example language code navigation, symbol search, bracket matching, and snippets.
  • and plugins:

    • VIM-go - this regularly updated plugin for Vim provides Go package compilation, folding and syntax highlighting, and integrated delve support. 

What might be more interesting than these tools is the fact that the Go creators set up an online environment where you can test products written in the Go programming language  -  The Go Playground.

Go programming language is fast 

The common opinion about Go is that it is a fast programming language. These aren’t just empty words - this comparison clearly proves that. The numbers in comparison with Python are clearly in favor of the Go side. 

But what actually makes the Go language stand out if we’re talking about speed? The answer could be Goroutines, which concurrently executes activity. A Goroutine is a lightweight thread managed by Go runtime. It consumes fewer resources than threads in Operating Systems, and when you compare these two solutions, the cost of creating them is definitely lower. 

Concurrency paradigm

If a program supports a concurrency paradigm it means that it can handle multiple tasks/actions (seemingly) at the same time in overlapping periods. Go supports concurrency paradigm natively, and it allows multi-threading, multi-processing, and asynchrony. The Golang runtime scheduler helps to manage all actions (Goroutines) that are created and need processor time. Channels also help - these typed conduits synchronize Goroutines and make communication between them more efficient and fluent.  

These aren’t the only Go features that are willingly used by engineers - dependency management, the power of runtime reflection, garbage collection, and components are also notable benefits. 

At CodiLime, we have utilized Golang’s strengths in numerous projects - such as when we built an automation module for a network observability solution for our client. 

Which well-known companies use the Go language? 

The features of Go are helpful in a wide range of industries. That is true, but does not make anything clearer! That’s why I have chosen some of (in my opinion) the most interesting case studies. The full list of companies that decided to rely on Go in their project you can find on the Go language website

Google

A programming language created by Google developers now supports Google solutions. The Chrome Optimization Guide service is one of them. This Go-based service suggests improvements (and the best time to implement changes) for your page load. Another one is Firebase, the hosting mobile platform for Google Cloud customers. At the beginning, only a small service was written in Go. When the application had developed, the engineers decided to completely replace the Node.js backends code with the Go language. 

These two are only a sample - Google uses Go in other interesting projects

Kubernetes

Kubernetes was originally established by Google, so I’ll put them together. Now, it’s a separate project developed by the Cloud-Native Computing Foundation. This open source container-orchestration system for managing containerized workloads and services was created by Google. And, as you can no doubt guess, it’s written in the Go language. The decision to use this programming language wasn’t a result of family ties, but due to Go’s fast tools, high-quality libraries, and garbage collection.   

Uber

Uber uses AresDB - a real-time analytics dashboard written in the Go programming language. It allows the company to efficiently unify, simplify, and improve real-time analytics database solutions. Developed with Go, AresDB allowed Uber to drop third-party database solutions and keep in-depth analytics in-house. 

Docker

The Docker, Inc. product (also named Docker) is a PaaS (Platform as a Service) which enables delivery of software in containers. As you might guess, Docker is built in Go. The engineers’ choice was based on Go’s ability to work in Linux, (as a chosen initial operating system), and a user-friendly path to incorporating Docker’s capabilities into their environments. This article explains why “Docker couldn’t have found a better partner than it did in Go.”

PayPal

This recognized multinational financial technology company supporting online money transfers is an alternative to traditional paper methods, such as checks and money orders. Their Payment Processing Platform had been developed in C++, but the complexity of the code slowed the platform’s modernized processes down. Go was chosen as a solution to simplify and develop the platform. 

Dropbox

Dropbox is a hosting service for storing and sharing files, and collaborating on projects. As the infrastructure grew, the Dropbox team started searching for a solution to scale the system more efficiently. That’s why they moved the crucial performance-critical backends from Python to Go, because of the better concurrency support and execution speed. But there is something more - some of Dropbox’s libraries built with the Go programming language are open source - examples can be found on their site

These use cases show how Go performs in specific  environments. If you are searching for how else Go can benefit your business, check our post - Why Go may be a good choice for your project

When is Golang not the best choice for your project? The disadvantages of Go

There is no one solution that fits for all users and cases. The same applies to the Go language. What are the barriers? 

  • No Generics - Go has no generics and it’s probably the most serious drawback if you are used to programming languages supporting them. On the other hand, the Go language provides substitutes for generics - e.g. interfaces and effective code generation.  But if you’re waiting for Go generics, there is good news. Work is in progress, and (fingers crossed) by the end of this year, you will notice some changes in the Go 1.18 beta version.  
  • Smaller default library  - you could notice a lack of functions, e.g. for strings and numbers. 
  • In some cases Go can be too simple - you might miss functions like map or reduce - the Go programming language doesn’t provide them.

Go has its weaknesses, just like every other programming language. In my opinion, it’s crucial to be aware of them so you can choose the solution which best addresses your needs. 

How about the Go programming language community? 

Behind Go stands a strong community - on GitHub you can find a whole range of useful information: helpful links on how to start and work with Go language,  sources of additional knowledge, Slack channels, dates of Go conferences, but that’s not all. There are also many books and podcasts worth your attention. Even the Go creators  still write new blog posts themselves when a new version releases - and developers can offer their ideas and contribute. Together, it all empowers the community, and the language itself.  

Conclusion

The Go programming language is still not as popular as Python, but it has made itself felt in the developers' world. Its minimal and simple syntax, innovative Goroutines instead of typical threads, and a wide range of tools have convinced even such major names as American Express, Cloudflare, Facebook, Microsoft, and Netflix. This list shows how many companies from all over the world are using the Go programming language. Its length is impressive and it’s still growing. If you’re wondering whether to give Go a chance, maybe this recommendation will speak to you. In my opinion, there is no better and stronger testimonial than from the community.

The “code that grows with grace” also grows with a supportive community and strong tools available. That makes the Go programming language a competitive and attention-worthy choice.

Katarzyna

Katarzyna Rybacka

Software engineer