What are the two major releases of Go in 2021 about? - Questers

What are the two major releases of Go in 2021 about?

Following the tradition, on November 10, we celebrate the anniversary of the first release of Golang – an open-sourced language developed by Google, that is focused on simplicity, efficiency and reliability. This year it turns 12. For all those years, Go has greatly evolved from a side project in Google to a widely-used programming language and an important part of the technology stacks of many tech companies (Facebook, Booking.com, Netflix and Google, of course, to name a few).

Usually, Go has two major releases throughout the year, and 2021 was not an exception. Most of the changes in the two updates this year are in the implementation of the toolchain, runtime, and libraries. And as usual, these releases are not expected to lead to any compatibility problems. Let’s take a look at some of the updates in these two releases.

Highlights from the 1.16 release

The new embedded package in 1.16 provided access to files at compile time using the new //go:embed directive. This made coding smoother as it became easier to bundle supporting data files into Go programs.

Go 1.16 also added macOS ARM64 support, ensuring Go has been fully supported by the new arm64 architecture of Apple.

Additionally, after the 2020 Go Developer Survey that revealed that 96% of Go developers have adopted modules for package management, the 1.16 release required the use of modules by default.

Highlights from the 1.17 release

The latest release of Go, which took place in August, has brought additional improvements to the compiler. Being more specific, it introduced a new way of passing function arguments and results. According to golang.org, this change has improved the performance of Go programs by 5% and reduced binary sizes by 2%

Go 1.17 also introduced pruned module graphs. If a module specifies Go 1.17 or higher, the module graph would include only the immediate dependencies of other go 1.17 modules, not their full transitive dependencies. This is expected to save time in day-to-day development as it should help avoid the need to download or read go.mod files for irrelevant dependencies.

In addition, while the 1.16 release didn’t introduce any changes to the language itself, the 1.17 one made three small enhancements – two new functions in the unsafe package (unsafe.Add and unsafe.Slice) to make it easier for programs to conform to the unsafe.Pointer rules. The other change is an extension to the language type conversion rules to allow conversions from slices to array pointers.

Of course, these highlights don’t cover all the improvements and bug fixes the two releases have introduced, but give a good sense of what the language is aiming at – improved performance and easier development.


Image source: https://github.com/MariaLetta/free-gophers-pack

field_tagged: