Go 1.8 is not yet released. These are work-in-progress release notes. Go 1.8 is expected to be released in February 2017.
The latest Go release, version 1.8, arrives six months after Go 1.7. Most of its changes are in the implementation of the toolchain, runtime, and libraries. There is one minor change to the language specification. As always, the release maintains the Go 1 promise of compatibility. We expect almost all Go programs to continue to compile and run as before.
The release adds support for 32-bit MIPS, updates the compiler back end to generate more efficient code, produces smaller binaries (TODO: link/numbers), reduces GC pauses by eliminating stop-the-world stack rescanning, adds HTTP/2 Push support, adds HTTP graceful shutdown, and simplifies sorting slices.
When explicitly converting structs, tags are now ignored for structural type identity. See change 24190 for details.
The language specification now only requires that implementations
support up to 16-bit exponents in constants. This does not affect
either the gc
or gccgo
compilers, both of
which still support 32-bit exponents.
Go now supports 32-bit MIPS on Linux for both big-endian
(linux/mips
) and little-endian machines
(linux/mipsle
).
Go now requires DragonFly BSD 4.4.4 or later.
The Plan 9 port's networking support is now much more complete and matches the behavior of Unix and Windows with respect to deadlines and cancelation.
Go 1.8 now only supports OS X 10.8 or later. This is likely the last Go release to continue supporting 10.8. Compiling Go or running binaries on older OS X versions is untested.
There are some instabilities on FreeBSD and NetBSD that are known but not understood. These can lead to program crashes in rare cases. See issue 15658, issue 16396, and issue 16511. Any help in solving these issues would be appreciated.
For 64-bit x86 systems, the following instructions have been added:
VBROADCASTSD
,
BROADCASTSS
,
MOVDDUP
,
MOVSHDUP
,
MOVSLDUP
,
VMOVDDUP
,
VMOVSHDUP
,
and VMOVSLDUP
.
For 64-bit PPC systems, the common vector scalar instructions have been added. See change 30510.
The yacc
(previously available via
“go
tool
yacc
”)
has been removed. As of Go 1.7 it was no longer used by the Go compiler.
It has moved to the “tools” repo and is and is available via
go get golang.org/x/tools/cmd/goyacc
.
Go 1.7 introduced a new compiler back end for 64-bit x86 systems. In Go 1.8, that back end has been developed further and is now used for all architectures.
The new back end, based on SSA, generates more compact, more efficient code and provides a better platform for optimizations such as bounds check elimination. The new back end reduces the CPU time required by our benchmark programs by N-M%. TODO: ARM binary size & perf numbers.
The temporary -ssa=0
flag introduced in Go 1.7 to disable
the new backend has been removed in Go 1.8.
In addition to enabling the new compiler back end for all systems, Go 1.8 also introduces a new compiler front end. The new compiler front end should not be noticeable to users is the foundation for future performance work.
The compiler and linker have been optimized and run faster in this release than in Go 1.7, although they are still slower than we would like and will continue to be optimized in future releases.
Due to changes across the compiler toolchain and standard library, binaries built with this release should typically be smaller than binaries built with Go 1.7, sometimes by as much as TODO numbers.
TODO
TODO
The go
command's basic operation
is unchanged, but there are a number of changes worth noting.
A new “go
bug
” command helps users file bug reports.
The “go
doc
” command
now groups constants and variables with their type,
following the behavior of
godoc
.
In order to improve the readability of the doc
's
output, each summary of the first-level items is guaranteed to
occupy a single line.
Documentation for interface methods is now only shown when requested explicitly.
Go now supports a “plugin
” build mode for generating
plug-ins written in Go, and a
new plugin
package for
loading such plug-ins at run time. Plug-ins support is only currently
available on Linux and Darwin.
The garbage collector no longer considers
arguments live throughout the entirety of a function. For more
information, and for how to force a variable to remain live, see
the runtime.KeepAlive
function added in Go 1.7.
The runtime's MemStats
type has been more throroughly documented.
As always, the changes are so general and varied that precise statements about performance are difficult to make. Most programs should run a bit faster, due to speedups in the garbage collector and optimizations in the standard library.
There have been significant optimizations bringing more than 10% improvements
to implementations in the
TODO TODO:
foo
,
bar
,
and
quux
packages.
Garbage collection pauses should be significantly shorter than they were in Go 1.7, often as low as 10 microseconds and usually under 100 microseconds. See the document on eliminating stop-the-world stack re-scanning for details. More work remains for Go 1.9.
defer
calls are now about twice as fast.
Calls from Go into C are now TODO% faster.
Examples have been added to the documentation across many packages.
The sort package
now includes a convenience function
Slice
to sort a
slice given a less function.
In many cases this means that writing a new sorter type is not
necessary.
Also new are
SliceStable
and
SliceIsSorted
.
The net/http package now includes a
mechanism to
send HTTP/2 server pushes from a
Handler
.
Similar to the existing Flusher
and Hijacker
interfaces, an HTTP/2
ResponseWriter
now implements the new
Pusher
interface.
As always, there are various minor changes and updates to the library, made with the Go 1 promise of compatibility in mind.
The tar implementation corrects many bugs in corner cases of the file format.
The Reader
is now able to process tar files in the PAX format with entries larger than 8GB.
The Writer
no longer produces invalid tar files in some situations involving long pathnames.
There have been some minor fixes to the encoder to improve the compression ratio in certain situations. As a result, the exact encoded output of DEFLATE may be different from Go 1.7. Since DEFLATE is the underlying compression of gzip, ping, zlib, and zip, those formats may have changed outputs.
The encoder, when operating in
NoCompression
mode, now produces a consistent output that is not dependent on
the size of the input buffer to the
Write
method.
The Writer
now encodes a zero MTIME
field when
the Header.ModTime
field is the zero value.
In previous releases of Go, the Writer
would encode
a non-sensible value.
Similarly,
the Reader
now updates the Header.ModTime
field only if the
encoded MTIME field is non-zero.
The DeadlineExceeded
error now implements
net.Error
and reports true for both the Timeout
and
Temporary
methods.
The package now supports boolean values. TODO: add docs in encoding/binary package, then link to package docs here.
The new methods
Int.Value
,
String.Value
,
Float.Value
, and
Func.Value
report the current value of an exported variable.
The new
function Handler
returns the package's HTTP handler, to enable installing it in
non-standard locations.
The PNG decoder now supports truecolor and grayscale transparency.
The PNG encoder is now faster and creates smaller output when encoding paletted images.
There is a new
method Rand.Uint64
to return uint64
values.
The package's parsing has been relaxed in two ways to accept
more input seen in the wild. First, it now accepts
a =
sign even if it's not followed by two hex
digits.
Second, it accepts a trailing soft line-break at the end of a
message. . That is, the final byte of the
message may be a =
sign and it will now be ignored.
TODO
Empty quoted strings are now allowed in the name part of an
address. That is, this is now a legal address:
"" <gopher@example.com>
The ParseDate
function has been exported.
If implementations of the Auth
interface return an empty toServer
value, the package
no longer sends trailing whitespace after the SMTP AUTH
command, which some servers rejected.
The new functions
PathEscape
and
PathUnescape
deal with path escaping.
The new methods
URL.Hostname
and
URL.Port
are accessors to the hostname and port fields of a URL
and deal with the case where the port may or may not be present.
The existing method
URL.ResolveReference
now properly handles paths with escaped bytes without losing
the escaping.
The URL
type now implements
encoding.BinaryMarshaler
and
encoding.BinaryUnmarshaler
.
Parse
now rejects relative URLs containing a ":
" in
the first path segment. Such paths should be prefixed with "./
".
The URL.String
method now prepends "./
" to such paths.
The new function
Swapper
was
added to support
the new sort.Slice
support.
The Unquote
function now strips carriage returns (\r
) in
backquoted raw strings.
The new function
Until
complements
the analogous Since
function.
ParseDuration
now accepts long fractional parts.
Parse
now validates days that are too small, in
addition to days that are too large.
The new method
T.Name
(and B.Name
) returns the name of the current
test or benchmark.
The new method
T.Context
(and B.Context
) returns
a Context
for
the current running test or benchmark.
The new function
CoverMode
reports what the test coverage mode is set to.
Tests and benchmarks are now marked as failed if the race detector is enabled and a data race occurs during execution.
SimpleFold
now returns its argument unchanged
if the provided input was an invalid rune.