que-es-go

What is Go

  • 4 min

Go is a compiled, statically typed, and simple language for building efficient software, especially useful for services, command-line tools, and concurrent systems.

We’re starting a new course, and this time it’s the turn of one of the languages that has grown the most in the last decade (or Golang, as it’s often called to look it up on Google).

If you come from languages like C++ or C#, you’ll feel right at home but with an incredible sense of lightness.

And if you come from Python or JavaScript, you’ll discover the power of static typing and native compilation without suffering the complexity of other low-level languages.

In this first post, we’re going to stick to the important stuff: what Go is, where it comes from, and why it’s worth learning. We’ll leave installation and the first program for the next one; otherwise, this introduction will get out of hand.

What is Go?

Go is an open-source, compiled, statically typed programming language created at Google in 2007 by three true giants of computer science: Robert Griesemer, Rob Pike, and Ken Thompson (yes, the same Ken Thompson who designed the Unix operating system and the B language).

The main motivation for creating Go was frustration. At Google, they had a huge problem: C++ code was very fast to execute but slow to compile and complex to maintain. On the other hand, languages like Python were easy to write but slow in execution.

So they decided to create a language that had the best of both worlds:

  1. The efficiency and safety of a compiled and typed language (like C++).
  2. The ease of writing and readability of a dynamic language (like Python).

The result was Go: a simple, modern language specifically designed for large-scale software engineering, the cloud, and distributed systems.

Why use Go?

Okay, there are many languages out there. Why should we invest time in learning Go? Here are the reasons why we think it’s worth it:

Go is famous for being a small language. It has very few reserved words (barely 25). There are no classes, no complex inheritance, no operator overloading.

This, which may initially seem like a limitation, is its greatest virtue. “Less is more”. Go code is easy to read and understand, even if you didn’t write it yourself.

Go is a compiled language. This means the source code is translated directly into machine code. There is no virtual machine (like in Java) or interpreter (like in Python).

The result is executable binaries that are incredibly fast and lightweight.

Perhaps Go’s strongest point. It was designed in the era of multi-core processors.

While in other languages creating threads is costly and complex, Go introduces Goroutines. These are very lightweight threads managed by Go’s own runtime. You can launch thousands of goroutines on a single machine without breaking a sweat.

Go makes concurrent programming, if not easy, then at least much more accessible and less error-prone than in other languages.

Go’s Standard Library is a marvel. You have almost everything you need “out of the box”: a production HTTP server, JSON handling, cryptography, testing tools… You often don’t need to install external libraries to do complex things.

Go has a very famous mascot called Gopher. You are likely to see this little blue creature everywhere while you learn the language. It’s part of Go’s culture.

With this, we have our mental map. Go is small, compiled, with a powerful standard library and a very particular way of handling concurrency.

In the next article, we’ll get our hands dirty: we’ll install Go, configure VS Code, and write our first Hello World program.