Go (programming language)

Go (also called Golang or Go language) is an open source programming language used for general purpose. Go was developed by Google engineers to create dependable and efficient software. Most similarly modeled after C, Go is statically typed and explicit.

The language was designed by taking inspiration for the productivity and relative simplicity of Python, with the ability of C. Some of the problems that Go addresses are slow build time, uncontrolled dependencies, effort duplication, difficulty of writing automatic tools and cross-language development.

Go works by using "goroutines," or lightweight processes, which allows further efficiencies. Go also uses a collection of packages for efficient dependency management.

Some examples of organizations that use Go include Google, Cloudflare, Dropbox, MongoDB, Netflix, SoundCloud, Twitch and Uber.

What does the Go programming language do?

Go includes a number of features such as its standard library, package management, static typing, support for testing as well as its platform independence. Go's standard library is based off the use of distributed packages. Package management refers to how Go will manage support for user-based and external package management. Packages can be published using a small set of commands. Static typing is a type system that ensures conversions and compatibility while avoiding the issues that come with dynamically typed languages. Go also supports unit tests to run in parallel with written code. In addition, due to Go's modular design, the code can be compiled onto almost any platform.

More specifically, Go uses lightweight processes that enable concurrent processing and behave like threads. The syntax will mimic patterns commonly seen in dynamic languages. Golang favors composition interfaces over inheritance. Some of Go's tools worth highlighting are its "Gofmt" feature that automatically formats and indents code for readability, "Go run" that compiles and runs code simultaneously, "Go get" that seamlessly integrates with GitHub and "Godoc" that generates HTML-based documentation according to the code structure and developer comments.

Go language
Learn how to write a function in Go.

Benefits of Go

Using Go over other programming languages has a number of advantages, such as:

  • Quick compilation and execution speed
  • No virtual machine (VM) needed
  • Portability
  • Lightweight goroutines that support concurrency
  • Interfaces enable loosely coupled systems
  • Automatic garbage collection
  • Memory safety
  • Independent error handling
  • Extensive built-in libraries

Drawbacks of Go

Some potential drawbacks include:

  • Does not support generics, or the ability to write abstract, implicit code
  • Lack of runtime safety
  • Enforces strict rules
  • Incompatible with function overloading
  • Not conventionally object-oriented

Applications of the Go programming language

Go is used by various software development teams and in various software. Applications using Go include container services like Docker and Kubernetes, cloud services such as Terraform and OpenShift, service orchestration tools such as Juju, and other applications such as Bitcoin networks -- for example, Lightning Network.

Companies that use the Go programming language include Couchbase, which uses Go for Query and Indexing services; Dropbox, which changed from using Python to Go; MongoDB, for tools related to MongoDB instances; and Netflix with some of its server architectures.

Go versus competitors

Golang has comparable features to other programming languages but provides an overall unique alternative. The main design goal of Go is to facilitate fast compilation, unlike some of the other common languages. When compared to C++, Go reduces the amount of runtime errors and dependencies while increasing memory safety and memory management. Ruby provides a safer approach, but requires an interpreter and takes longer to compile. Java is another popular programming language; however, it requires a virtual machine in order to run the code. Go eliminates this necessity and combats the complexity and verbosity of Java code itself.

Developers will want to code in Go when they want a programming language that is good for web development, front-end development, command-line scripting and network server applications. Because of the Go language's fast startup time, low runtime overhead and ability to run without a virtual machine, Go has become a very popular language for writing microservices. In addition, Go can also be used for concurrent programming -- a strategy to execute multiple tasks at one time. As for how Go compares to how often other program languages are used and rated, Go is often rated within the bottom or middle of top ten lists for the most in-demand and liked programming languages -- typically just behind other known languages such as JavaScript and Python.

The history of Go

The creation of Go was motivated by the need to solve software engineering issues at Google and to provide an alternative for C++. Also, as multi-core processors became more popular, developing a language with higher productivity levels was necessary.

Go started being designed at Google in 2007. The designers wanted to create a programming language that was easier to use but still had the useful characteristics found in other languages such as C++, Python or JavaScript. By 2008, the language started taking shape, as it moved on from prototype stages and was publicly announced in 2009. In that same year, Go also became an open source project where community members could begin ideas and code. Version 1.0 was later released in 2012.

Over the years, new updates and features were added, such as in 2018, when generics and error handling were added. The popularity of Go has continued to grow and fluctuate. 

This was last updated in May 2020

Continue Reading About Go (programming language)

Dig Deeper on IT operations careers and skills