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.
Error wrapping
Support for error wrapping arrives, as per the Error Values proposal.
From the release notes:
An error
e
can wrap another errorw
by providing anUnwrap
method that returnsw
. Bothe
andw
are available to programs, allowinge
to provide additional context tow
or to reinterpret it while still allowing programs to make decisions based onw
.
View the documentation and the FAQ for more information.
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
ToValidUTF8
function, and more.
Full release notes available here.
New default proxy
The release is causing some controversy and discussion, however. Some opened issues on GitHub raise concerns regarding the new default proxy system that 1.13 introduces. With this release, by default Go uses a Google Privacy Policy owned proxy to fetch module dependencies.
SEE ALSO: The trendy five: Closing summer with our favorite August 2019 GitHub repos
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.
The post Golang 1.13: Error wrapping, improved performance, new default proxy appeared first on JAXenter.
Source : JAXenter