Golang 1.13: Error wrapping, improved performance, new default proxy
It’s time! Version 1.13 of Golang has arrived, with new language changes in tow and some performance improvements. This time around, changes include a more uniform and modernized set of number literal prefixes, improved modules support, error wrapping, TLS 1.3 on by default, and a few more tweaks.
Time to get up and Go. The newest version of Golang was released on September 3, 2019, just six months after Go 1.12. Welcome version 1.13! This version continues to maintain Go 1 version compatibility.
This release makes some changes to the language, including error wrapping, improved modules, and some language changes.
Golang 1.13 features
Let’s have a look at some highlights and new features.
Support for error wrapping arrives, as per the Error Values proposal.
From the release notes:
ecan wrap another error
wby providing an
Unwrapmethod that returns
ware available to programs, allowing
eto provide additional context to
wor to reinterpret it while still allowing programs to make decisions based on
Number literal improvements
The new release makes number literal prefixes more uniform and modernized.
1.13 introduces improvements to: binary integer literals, octal integer literals, hexadecimal floating point literals, imaginary literals, and digit separators.
TLS 1.3 by default
According to Cloudfare, the TLS 1.3 protocol (Transporation Layer Security) enhances HTTPS performance and improves browser security and privacy. It includes a full handshake signature and downgrade protection.
Its default inclusion in Golang allows for improved page loading time.
Changes & optimizations
Some minor changes and performance optimizations include:
- New escape analysis: According to Matthew Dempsky: “It more aggressively optimizes ~188 instances…but more pessimistically optimizes 11”.
- Encoding/Json optimizations
- ARM optimizations
- Start-up time and speed optimizations: Performance for most uses improves by 30%.
- Minor library changes: Including upgrading to Unicode 11.0, new slice function, new
ToValidUTF8function, and more.
New default proxy
Users can change this configuration.
According to the release notes:
As of Go 1.13, the go command by default downloads and authenticates modules using the Go module mirror and Go checksum database run by Google. See https://proxy.golang.org/privacy for privacy information about these services and the go command documentation for configuration details including how to disable the use of these servers or use different ones. If you depend on non-public modules, see the documentation for configuring your environment.
PHP and Go developer Jesse Donat opened up an issue on GitHub titled ‘cmd/go: permit marking a module as private in go.mod‘.
The new proxy system requires individual machines environmental variables to be set up for private modules. This means knowledge about the build that is not kept in the repo. This is not ideal.
Test it out!
Upgrade to the latest release from the download page.
Follow the installation instructions available here and get started with the new features.
Already looking forward to the next release? Golang verison 1.14 is due by February 1, 2020.