what is golang

Golang 101: All the Basics You Need to Know

Go (or Golang) is definitely not the most popular programming language, but its over 10-year journey in the development world goes slowly but surely, revealing many advantages over other, more prominent, backend languages.

Having said this now is a good moment to take a closer look at Go's origins and find out why Go remains the language that programmers are willing to explore. 

Go or Golang?

Before deep diving into ancient history and tech-related details, the name clarification should occur: Go or Golang? 

The thing is, both are correct. The language is officially called Go. The "Golang" nickname arose because the website is golang.org, not go.org, which was unavailable at the time. Initial confusion turned out to be a good thing, as the "Golang" moniker is more unique and thus more searchable on the internet than the common "Go". Even on social media, the hashtag #golang is dominant regardless of the official Go name of the language.

The language name is Go, not GO, even though there are two capital letters on the official logo.

What is Golang?

Go (Golang) is an open-source, backend programming language used for: 

  • Server management
  • Web development
  • Cloud infrastructure setting
  • And command-line interfaces 

Go was born out of frustration that was growing among Googlers struggling with other backend languages. They shared a common, burning dislike for C++ in particular. Developers considered it sluggish, demanding, over-complicated, and - this is the worst sin - unstable and slowing down the development process. Long story short, C++, excellent at "old simpler times," uncovered its flaws in the era of multicore, networked machines, huge codebases, and AI-driven and cloud-native solutions. 

The search for a better alternative began in 2007, kickstarted by Robert Griesemer, Rob Pike, and Ken Thompson. They were employed at Google back then, and the corporation suffered from many inconveniences from using complicated and confusing programming languages, mainly C-related. The trio decided that it would be a good direction not to focus on overcoming challenges C implied but on developing a better alternative for C. They focused on cherry-picking the best-of-breed features of other languages (besides C++, also Python, and Ruby), combining them smoothly, and wrapping them up in convenient, modern form.

Go language is often referred to as "C for the twenty-first century" when it comes to syntax.

In November 2009, Griesemer, Pike, and Thompson announced the Go publicly, and version 1.0 was released in March 2012.

Andrew Gerrand, software engineer, who worked on developing Go at Google and building a community around this language, wrote back then:

The driving motivation for Go 1 is stability for its users. People who write Go 1 programs can be confident that those programs will continue to compile and run without change, in many environments, on a time scale of years. Similarly, authors who write books about Go 1 can be sure that their examples and explanations will be helpful to readers today and into the future. - Andrew Gerrand, 28 March 2012, "Go version 1 is released", The Go Blog

It is worth emphasizing that Golang's DNA is not just a simple C reincarnation. It is very true that syntactically Go is similar to C, yet there is also built-in tooling for memory safety, garbage collection, structural typing, and concurrency in Go. Golang's main characteristics are actually borrowed from many other languages. We've got: 

  • Static typing and run-time efficiency (like in C)
  • Readability and usability (like in Python or JavaScript)
  • High-performance networking and multiprocessing

All the features of Go benefit one,  ultimate goal: stability.

Go in stats

A quick look at Stack Overflow Survey shows that Go is way less popular than JavaScript and Python. These languages are dominating for another year in a row, and there is nothing to suggest that the situation will change any time soon.

go stack overflow

Source: Stackoverflow

However, Go - ranked just 12th - should not be neglected. Sure, it is not the most popular programming language worldwide, and a relatively small number of developers use it daily, but - given its relatively young age - it cannot be a surprise. Both JavaScript and Python had time to carve their positions in the developer's community, and - when they were set - any changes would not happen overnight. 

Compared to its older competitors, Go is relatively lone and bare. There are no frameworks that would smooth out working with it, and the standardized package manager came up just three years ago. And these are potent blockers. So, why do we even talk about Go? 

Despite the relatively low place in the general popularity contest, Go is the third language that developers want to learn (including TypeScript). And not only Stack Overflow Survey that says that. HackerRank also proves developers' interest in Go. According to their study from 2020, Golang has been the most desired language to learn for three years in a row. 

golang hackerrank

Source: HackerRank 2020 Developer Skills Report

What is more, Go is the 5th most popular language on GitHub in terms of stars.

go github

Source: GitHub

Why are developers willing to learn Go if its flaws are so evident? We will cover several technical reasons, but the most appealing trait of Go is its ease of use and relatively flat learning curve. 

And no wonder. Go that was developed as the effect of frustrations caused by overly complicated C++ was meant to be as simple as possible. 

The Core Principle of Go (Golang)

The goal behind Go was to create a language, loosely based on the syntax of C, that would eliminate extra features of other modern languages, such as method and operator overloading, pointer arithmetic, and type inheritance. Excluding these features allows engineers to create lean and agile solutions enabling them to speed up the performance on multiple cores, support concurrency, and scale as cores are added. 

Go's code is quite simple and very easy to compile. It requires setting up a MySQL database in Docker, spicing a bit with HTML, and... that is it. Given the growing matter of performance, not only in terms of solely app's speed but also in implementing microservices, and cloud-native architecture, Go is on the right track to replace legacy tech stacks such as Java or C.  

The main features of Go's syntax are:

  • Optional concise variable declaration and initialization through type inference (x := 0 instead of int x = 0; or var x = 0;)
  • Quick compilation processes
  • Remote package management 

Go has also quite a different approach to common developer challenges. It has built-in concurrency primitives: light-weight processes (goroutines), channels, and the select statement. Also, the Go interface system is in place of virtual inheritance, and type embedding instead of non-virtual inheritance. 

Go's syntax is designed with clarity and tooling in mind. Compared to other languages in the C family, it is very modest with 25 keywords (C99 has 37; C++11 has 84; the numbers continue to grow) and regular.  

Advantages of Golang

  • It is simple and easy to learn

Given its simplicity, Go is great for beginners. Its syntax is small and easy to analyze and interpret without digging through documentation. Learning Go is a breeze for developers who are even slightly familiar with a few other languages. 

  • It is agile and can be used for several purposes

Go's flexibility makes it a good solution for handling cloud projects, AI and Big Data, and standard app development. 

  • It is compiled and fast

Compiled languages are translated to machine code before execution, as opposed to interpreted languages, which makes them fast.

  • It has support enabling creating apps across multiple systems

Regardless if it is Windows, Linux, or Mac, developers have a variety of integrated development environments (IDEs) and editors to choose from, such as Emacs, Vim, VSCode, and Atom, to name a few.

Disadvantages of Golang 

  • Go is still quite young

The immaturity of Golang is clear when we analyze the number of libraries and frameworks that could ease working with it.  

  • Error handling

There is some criticism of Go's error handling model because it is quite unconventional. In Go, all errors are values, which results in a fair amount of functions returning an error. 

  • Simplicity that (sometimes) can be limiting

Sometimes developers may feel that the simplicity of Go, pleasant at the beginning, turns out to be a limitation. Lacking some built-in features causes the need to write the workarounds, which means more extensive code. 

Summary

Go, as we hoped to prove, can benefit many organizations, and there is no doubt that this language is still before the peak of its career. It is, however, gaining momentum as the circumstances are favorable. The rise of microservice architecture,  the dominance of cloud, and the general desire for higher performance make it the more and more good tech stack that’s worth keeping an eye on.

Flutter vs Ionic: Which Cross-Platform Framework To Use in 2022
Why Use Flutter for Animations in Mobile App Development?
prototype what is it What is a Prototype: Benefits and Prototyping Types