Go 1.6 Released
18 February 2016
The official release notes are available at https://golang.org/doc/go1.6. This is my highlights reel :)
If you can’t wait to get Go 1.6 installed then go ahead and run brew update
and brew upgrade go
on OSX while you read the rest of this post.
Coming in at around 6 months after Go 1.5’s release, Go 1.6 is an incremental release that mostly brings updates to the core library. It brings a few updates to the Cgo toolchain and some improvements to the parity between the GCC and Cgo tools. The good news is that the release maintains Go 1 compatibility so your code should just compile right away with Go 1.6’s goodness.
The highlight of the release has to be the out-of-the-box automatic support for HTTP/2 servers and clients. If you’re communicating over HTTPS, then Go’s standard library HTTP servers and clients will automatically connect over HTTP/2 if it’s appropriate.
Go clients and servers will automatically use HTTP/2 as appropriate when using HTTPS. There is no exported API specific to details of the HTTP/2 protocol handling, just as there is no exported API specific to HTTP/1.1.
The sort
package’s Sort algorithm has been improved to make roughly 10% fewer calls to the Less
and Swap
functions. The release notes warn that the new algorithm is likely to change the ordering of elements that are sorted as equal. If you need to preserve original ordering of elements then you should use sort.Stable
instead or tweak your Less
function to be more specific about the ordering of those elements.
If you’ve been following the dependency management story in Go (who isn’t?), as of Go 1.6 the vendoring support provided through the GO15VENDOREXPERIMENT
environment variable is now stable. It is enabled by default and no longer considered experimental. If for any reason you need to disable it, you can set GO15VENDOREXPERIMENT=0
but keep in mind that the environment variable will be removed in Go 1.7.
Minor changes
There are a wealth of minor changes to the core library. The ones I find most interesting are:
The ServeFile
function in net/http
is now more secure by default by refusing to serve requests for URLs that contain a “..” in their path.
Parsing URLs with the Parse
function in net/url
is now more spec-compliant. The example given in the release notes shows that spaces in a host name are no longer permitted.
Regexp
now has a Copy
method, intended for use in high concurrency scenarios where contention on the single sync.Mutex
on a Regexp
would cause a slowdown.
And finally, the time.Parse
function now rejects 29 February in non-leap years as well as impossible dates such as 31 April. Previously it would only reject dates over 31 (e.g. 32 January).
Now go try it out already! brew update && brew upgrade go
will get you updated on OSX.