Originally posted on sdtimes.
The Go programming language is continuing on a path of accelerated adoption and is beloved by the developers that use it.
This is evidenced by several recent developer surveys, as well as sentiments expressed by developers who use the language.
In JetBrains’ 2021 State of Developer Ecosystem report, Go was among the top five languages that developers were planning to adopt. It also was one of the top five languages developers were learning in the last year and was one of the five fastest growing languages too.
In the official 2021 Go developer survey, 92% of survey respondents said their satisfaction with Go was very high.
Go is the language of the cloud, so it’s no wonder that it’s continued to increase in popularity over the past few years as cloud-native development becomes more and more prevalent.
“If you do stuff on any cloud platform … people want to standardize on Go,” said Steve Ng, principal developer relations lead of Asia Pacific and Japan at observability company New Relic.
What makes Go the “language of the cloud?” According to Andre Eriksen, founder of back-end development company Encore.dev, there are a few reasons for this. One reason is that Docker was originally built using Go.
In addition, a lot of the Cloud Native Computing Foundation (CNCF) projects have been built in Go, according to Eriksen. Ng added that a lot of those CNCF projects also interact with and feed off each other.
Another contributing factor is that Go is an incredibly reliable language, partly because of the way it handles errors. It encourages developers to check for errors as they code, rather than relying on throwing and catching exceptions like in other programming languages.
“And the way you write code, when you’re using a programming language [that uses exceptions], is you kind of stop thinking about errors, and you just assume everything is gonna go well and if something goes wrong, an exception will be thrown somewhere, and we’ll try to handle that,” said Eriksen. “And that works very well, when everything goes well. And then it goes terribly when something goes wrong. And Go does it very differently, where errors are just any other value. And it kind of forces you to think about errors much more, every time you are doing an operation in Go, like when you’re writing to a file or you’re sending a request over the internet over HTTP, Go forces you just to think about what if this goes wrong, and as a result, the reliability systems built with Go tends to be very, very high.”
Another reason people may see it as reliable is because it has the backing of Google. The language was developed at Google in 2009 and version 1.0 was released publicly in 2012. Go is still maintained by the company today and is used in its production environments too.
One nice thing, according to Eriksen, is that Google has taken a conservative view on changing the language. The changes that get made to the language are usually to the edges, rather than the core language itself.
Google has made a commitment to backwards compatibility in Go. According to Eriksen, this means that when the language gets updated, those updates aren’t going to break your application. The exception to this has been if there is a major security vulnerability that needs to be addressed.
Eriksen added: “If you look at other programming languages … no one breaks things because they want to, it’s because they see we can make this better. And we just need to change how we do something. But it creates this sort of fear of upgrading, and you end up sticking around on an old version because upgrading to the latest Java release is so scary, and then you lose out on security fixes and performance improvements, whereas in the in the Go community, pretty much every single company that I’ve ever heard of, they’re running the latest release from the day or the week, that it’s published.”
According to Eriksen, Google is famous for running their production systems on the release candidates for Go as well. This gives developers confidence in upgrading to the latest version because by the time the final release is ready, you know that everything is working already inside of Google, which provides a very strong signal to the community that the release has been thoroughly tested.
“It is super nice because we try to stay up to date in the Go library,” said Mya Longmire, software engineer at database company InfluxData. “So every time there is a new stable release, we try as quickly as possible to update to it. And having that backwards compatibility helps the work of the developers.”
Google also listens to the community and their pain points when it comes to deciding on new features to add, such as with the recent addition of support for generic programming.
Go finally adds support for generic programming
For a long time, generics weren’t a part of Go, which led to disastiasfaction among Go developers. Generic programming allows developers to represent functions and data structures while factoring out types, according to the Go language team.
“With no generics, you decrease your code reusability,” said Longmire. “So you just have to write a little bit more code to do the same thing. And that might seem like a big hurdle if you’re coming from something that’s built on generics, like Java.”
In the 2020 Go developer survey, 26% of respondents said Go lacked language features they need, and 88% of those respondents cited generics being a critical missing feature. The survey also revealed that 18% of respondents were prevented from using Go because it didn’t have generics.
This pain point was remedied in March 2022 with the release of Go 1.18. This release introduced support for generics, with a commitment to add support for more complicated generic use cases in further releases.
“Go 1.18 is a massive release that includes new features, performance improvements, and our biggest change ever to the language. It isn’t a stretch to say that the design for parts of Go 1.18 started over a decade ago when we first released Go,” the Go team wrote in a blog post announcing the release.
Go thrives in large scale software engineering
According to Eriksen, Google has put a large focus on large scale software engineering for Go. “This is not a thing for just building small programs, it’s a thing for teams building software over long periods of time,” said Eriksen.
This is not to say that Go is only popular at the largest companies. In fact, according to the 2021 Go Developer Survey, a majority of survey respondents worked on teams of less than 10 people. Twenty-eight percent of respondents worked at small or medium-sized businesses and 25% worked at startups.
Go is particularly suited for large applications because of its compilation speed. According to Eriksen, a Java application that takes 10s of minutes or even up to an hour to compile might take a few minutes had it been written in Go.
Go is leading the field on supply chain security
Supply chain security has been top of mind for many people in the past year, especially in the US.
The Go team has taken that into consideration by putting a lot of focus into making sure that security vulnerabilities aren’t introduced upstream of a project based on some dependency in use, according to Eriksen.
“I think Go is leading the field far and beyond everything else with their approach to supply chain security,” he said.
Knowledge sharing is a big plus in Go
One of Longmire’s favorite things about Go is its documentation. She said that reading through the documentation is actually how she learned the language.
“They have interactive documentation, which is really nice,” she said. “And you can find anything you’re looking for on how to use something or how to set something up, which is very uncommon in newer languages.”
She also said that the syntax of Go is super readable, which helps a lot when working on legacy codebases or reading other developers’ code.
Ng echoed this sentiment, saying that knowledge sharing in the community has really improved over the years. This, he says, is another way in which Go has benefited from the CNCF because so many CNCF projects are written in Go and a lot of them feed off each other.