2021-08-03 07:54:24 +03:00
|
|
|
---
|
|
|
|
title: Go 1.6 is released
|
|
|
|
date: 2016-02-17
|
|
|
|
by:
|
|
|
|
- Andrew Gerrand
|
|
|
|
summary: Go 1.6 adds HTTP/2, template blocks, and more.
|
|
|
|
---
|
2016-02-17 22:41:12 +03:00
|
|
|
|
|
|
|
|
2021-11-18 06:34:23 +03:00
|
|
|
Today we release [Go version 1.6](/doc/go1.6),
|
2016-02-17 22:41:12 +03:00
|
|
|
the seventh major stable release of Go.
|
2021-11-18 06:34:23 +03:00
|
|
|
You can grab it right now from the [download page](/dl/).
|
2023-12-07 23:02:17 +03:00
|
|
|
Although [the release of Go 1.5](/blog/go1.5) six months ago
|
2016-02-17 22:41:12 +03:00
|
|
|
contained dramatic implementation changes,
|
|
|
|
this release is more incremental.
|
|
|
|
|
2020-03-10 06:54:35 +03:00
|
|
|
The most significant change is support for [HTTP/2](https://http2.github.io/)
|
2021-11-18 06:34:23 +03:00
|
|
|
in the [net/http package](/pkg/net/http/).
|
2016-02-17 22:41:12 +03:00
|
|
|
HTTP/2 is a new protocol, a follow-on to HTTP that has already seen
|
|
|
|
widespread adoption by browser vendors and major websites.
|
2021-11-18 06:34:23 +03:00
|
|
|
In Go 1.6, support for HTTP/2 is [enabled by default](/doc/go1.6#http2)
|
2016-02-17 22:41:12 +03:00
|
|
|
for both servers and clients when using HTTPS,
|
2020-03-10 06:54:35 +03:00
|
|
|
bringing [the benefits](https://http2.github.io/faq/) of the new protocol
|
2016-02-17 22:41:12 +03:00
|
|
|
to a wide range of Go projects,
|
2020-03-10 06:54:35 +03:00
|
|
|
such as the popular [Caddy web server](https://caddyserver.com/download).
|
2016-02-17 22:41:12 +03:00
|
|
|
|
|
|
|
The template packages have learned some new tricks,
|
2021-11-18 06:34:23 +03:00
|
|
|
with support for [trimming spaces around template actions](/pkg/text/template/#hdr-Text_and_spaces)
|
2016-02-17 22:41:12 +03:00
|
|
|
to produce cleaner template output,
|
2021-11-18 06:34:23 +03:00
|
|
|
and the introduction of the {{raw "[`{{block}}` action]"}}(/pkg/text/template/#hdr-Actions)
|
2016-02-17 22:41:12 +03:00
|
|
|
that can be used to create templates that build on other templates.
|
2021-09-03 16:56:26 +03:00
|
|
|
A [new template example program](https://cs.opensource.google/go/x/example/+/master:template) demonstrates these new features.
|
2016-02-17 22:41:12 +03:00
|
|
|
|
2021-11-18 06:34:23 +03:00
|
|
|
Go 1.5 introduced [experimental support](/s/go15vendor)
|
2016-02-17 22:41:12 +03:00
|
|
|
for a “vendor” directory that was enabled by an environment variable.
|
2021-11-18 06:34:23 +03:00
|
|
|
In Go 1.6, the feature is now [enabled by default](/doc/go1.6#go_command).
|
2016-02-17 22:41:12 +03:00
|
|
|
Source trees that contain a directory named “vendor” that is not used in accordance with the new feature
|
|
|
|
will require changes to avoid broken builds (the simplest fix is to rename the directory).
|
|
|
|
|
|
|
|
The runtime has added lightweight, best-effort detection of concurrent misuse of maps.
|
|
|
|
As always, if one goroutine is writing to a map, no other goroutine should be reading or writing the map concurrently.
|
|
|
|
If the runtime detects this condition, it prints a diagnosis and crashes the program.
|
|
|
|
The best way to find out more about the problem is to run it under the
|
2023-12-07 23:02:17 +03:00
|
|
|
[race detector](/blog/race-detector),
|
2016-02-17 22:41:12 +03:00
|
|
|
which will more reliably identify the race and give more detail.
|
|
|
|
|
|
|
|
The runtime has also changed how it prints program-ending panics.
|
|
|
|
It now prints only the stack of the panicking goroutine, rather than all existing goroutines.
|
|
|
|
This behavior can be configured using the
|
2021-11-18 06:34:23 +03:00
|
|
|
[GOTRACEBACK](/pkg/runtime/#hdr-Environment_Variables) environment variable
|
|
|
|
or by calling the [debug.SetTraceback](/pkg/runtime/debug/#SetTraceback) function.
|
2016-02-17 22:41:12 +03:00
|
|
|
|
|
|
|
Users of cgo should be aware of major changes to the rules for sharing pointers between Go and C code.
|
|
|
|
The rules are designed to ensure that such C code can coexist with Go's garbage collector
|
|
|
|
and are checked during program execution, so code may require changes to avoid crashes.
|
2021-11-18 06:34:23 +03:00
|
|
|
See the [release notes](/doc/go1.6#cgo) and
|
|
|
|
[cgo documentation](/cmd/cgo/#hdr-Passing_pointers) for the details.
|
2016-02-17 22:41:12 +03:00
|
|
|
|
|
|
|
The compiler, linker, and go command have a new `-msan` flag
|
|
|
|
analogous to `-race` and only available on linux/amd64,
|
|
|
|
that enables interoperation with the
|
2020-03-10 06:54:35 +03:00
|
|
|
[Clang MemorySanitizer](http://clang.llvm.org/docs/MemorySanitizer.html).
|
2016-02-17 22:41:12 +03:00
|
|
|
This is useful for testing a program containing suspect C or C++ code.
|
|
|
|
You might like to try it while testing your cgo code with the new pointer rules.
|
|
|
|
|
|
|
|
Performance of Go programs built with Go 1.6 remains similar to those built with Go 1.5.
|
|
|
|
Garbage-collection pauses are even lower than with Go 1.5,
|
|
|
|
but this is particularly noticeable for programs using large amounts of memory.
|
|
|
|
With regard to the performance of the compiler tool chain,
|
|
|
|
build times should be similar to those of Go 1.5.
|
|
|
|
|
2021-11-18 06:34:23 +03:00
|
|
|
The algorithm inside [sort.Sort](/pkg/sort/#Sort)
|
2016-02-17 22:41:12 +03:00
|
|
|
was improved to run about 10% faster,
|
|
|
|
but the change may break programs that expect a specific ordering
|
|
|
|
of equal but distinguishable elements.
|
|
|
|
Such programs should refine their `Less` methods to indicate the desired ordering
|
2021-11-18 06:34:23 +03:00
|
|
|
or use [sort.Stable](/pkg/sort/#Stable)
|
2016-02-17 22:41:12 +03:00
|
|
|
to preserve the input order for equal values.
|
|
|
|
|
|
|
|
And, of course, there are many more additions, improvements, and fixes.
|
2021-11-18 06:34:23 +03:00
|
|
|
You can find them all in the comprehensive [release notes](/doc/go1.6).
|
2016-02-17 22:41:12 +03:00
|
|
|
|
|
|
|
To celebrate the release,
|
2023-12-18 23:16:58 +03:00
|
|
|
[Go User Groups around the world](/wiki/Go-1.6-release-party)
|
2016-02-17 22:41:12 +03:00
|
|
|
are holding release parties on the 17th of February.
|
|
|
|
Online, the Go contributors are hosting a question and answer session
|
2020-03-10 06:54:35 +03:00
|
|
|
on the [golang subreddit](https://reddit.com/r/golang) for the next 24 hours.
|
2016-02-17 22:41:12 +03:00
|
|
|
If you have questions about the project, the release, or just Go in general,
|
2020-03-10 06:54:35 +03:00
|
|
|
then please [join the discussion](https://www.reddit.com/r/golang/comments/46bd5h/ama_we_are_the_go_contributors_ask_us_anything/).
|
2016-02-17 22:41:12 +03:00
|
|
|
|
|
|
|
Thanks to everyone that contributed to the release.
|
|
|
|
Happy hacking.
|