Promises of SONiC Network OS starts in

03

Days

:

06

Hours

:

07

Minutes

:

17

Seconds

03

Days

:

06

Hrs

:

07

Min

:

17

Sec
Close

17 September 2021

Software Development

The Go programming language—everything you should know

22 minutes reading

The Go programming language—everything you should know

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.

New call-to-action

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 makes the Go language so special?

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.

The best IDEs and editors for Go developers

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. 

What the Golang is best used for in practice

Cloud Native Development

Go is very useful for building cloud-native apps due to its concurrency and networking capabilities as well as its high degree of portability. Several pillars of cloud-native computing, such as Docker, Kubernetes, and Istio, were actually built using the Go programming language.

Various Network Services

Concurrency is the lifeblood of network applications, and Go's native concurrency features, primarily goroutines and channels are well suited for such tasks. Therefore, a lot of Go projects are useful for networking, distributed tasks, and cloud services, such as APIs, web servers, and simple frameworks for web applications.

Standalone Tools and Utilities

Go is a compiled language, which means that applications are compiled into binary files. These binaries have next to no external dependencies themselves and can be run virtually anywhere. Because programs in Go launch rapidly and can be easily packaged for redistribution, they are useful for developing utilities and other tools. An instance is the access server Teleport (for SSH, among other things). Teleport may be quickly and simply installed on servers by downloading a prebuilt binary or constructing it from the source code.

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.

Golang Development Services for your project

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? 

  • Limited generics support - for a long time, Go didn't have generics. Finally, in Go 1.18, generic types and functions were introduced. However, generics aren't fully supported ye. For example, methods with generic arguments aren't implemented.
  • 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. 

When to bet on the Golang language

Every programming language has trade-offs, and Golang is no exception. For example, scripts in Python can be written faster because of no enforced coding style and more syntactic sugar whereas Go might require more effort to produce code as it has more explicit syntax.

Undoubtedly, Go is a promising language, but it has a specific use. It is mainly used in API/RPC services and writing CLIs. There is a significant interest in using Go in different areas but some developers face specific barriers when working in these areas. Primarily, Golang was developed by Google to address scalability problems in software where hardware resources are constrained. Go is also useful for solving processing time bottleneck problems.

The backend of late-stage firms with expanding user bases frequently has trouble keeping up with the volume of activities. Since Golang supports concurrency functions and has a minimal memory footprint, it is ideal for backend applications where servers must handle high demand.

Golang is a programming language that Dropbox utilizes to effectively manage its network of more than 500 million customers. The language is also excellent for developing e-commerce websites, which receive millions of visitors each month. The resource-intensive services Docker, Terraform, and Kubernetes are all powered by Golang.

Go language development 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.

Limitations of the Go language

When choosing a programming language it is important to know the limitations before making a decision. It will save your time and money. 

iOS applications development

It is debatable but many people claim that Golang might set limitations for building iOS applications. You can find developers having problems answering questions concerning Golang-based iOS application development if you visit such troubleshooting forums.

Additionally, Go is not a perfect solution for developers who want to utilize only one language for both Android and iOS projects. Therefore, the development in Go has some limitations and it does not always go smoothly.

As Golang develops, it should anticipate that there will also be improved tools for iOS development.

Not Being Adjustable

Those who support dynamically typed languages believe that this statically typed language gives less coding flexibility. Of course, it is the nature of this type of programming language but it is worth knowing when choosing the best suitable option for your product. 

Go’s future development

Future Go development will increasingly focus on the preferences and requirements of its developer community, with Go's maintainers modifying the language to better serve this audience rather than setting a rigid precedent. Generics are a prime example, which were eventually included into the language after significant debate about how to proceed.

The 2021 Go Developer Survey indicated that while Go users were generally satisfied with the language's capabilities, there was still much space for development. Dependency management, a perennial problem in Go, bug diagnosis, and reliability were the top areas where users requested changes, with problems like memory utilization, CPU usage, binary sizes, and build times receiving considerably less attention.

Go's speed and ease of development are yet to be fully used in other cases, and its utilization into corporate development is still unknown. However, Go's future as a significant programming language is already secured, certainly in the cloud, where its speed and ease of use make it easier to build a scalable infrastructure that can be kept up over time.

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.

Check how we provide Golang development services for clients worldwide.

Katarzyna

Katarzyna Rybacka

Software engineer