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, 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 language specification for details.
The language specification now only requires that implementations
support up to 16-bit exponents in floating-point 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:
LXS
,
LXSDX
,
LXSI
,
LXSIWAX
,
LXSIWZX
,
LXV
,
LXVD2X
,
LXVDSX
,
LXVW4X
,
MFVSR
,
MFVSRD
,
MFVSRWZ
,
MTVSR
,
MTVSRD
,
MTVSRWA
,
MTVSRWZ
,
STXS
,
STXSDX
,
STXSI
,
STXSIWX
,
STXV
,
STXVD2X
,
STXVW4X
,
XSCV
,
XSCVDPSP
,
XSCVDPSPN
,
XSCVDPSXDS
,
XSCVDPSXWS
,
XSCVDPUXDS
,
XSCVDPUXWS
,
XSCVSPDP
,
XSCVSPDPN
,
XSCVSXDDP
,
XSCVSXDSP
,
XSCVUXDDP
,
XSCVUXDSP
,
XSCVX
,
XSCVXP
,
XVCV
,
XVCVDPSP
,
XVCVDPSXDS
,
XVCVDPSXWS
,
XVCVDPUXDS
,
XVCVDPUXWS
,
XVCVSPDP
,
XVCVSPSXDS
,
XVCVSPSXWS
,
XVCVSPUXDS
,
XVCVSPUXWS
,
XVCVSXDDP
,
XVCVSXDSP
,
XVCVSXWDP
,
XVCVSXWSP
,
XVCVUXDDP
,
XVCVUXDSP
,
XVCVUXWDP
,
XVCVUXWSP
,
XVCVX
,
XVCVXP
,
XXLAND
,
XXLANDC
,
XXLANDQ
,
XXLEQV
,
XXLNAND
,
XXLNOR
,
XXLOR
,
XXLORC
,
XXLORQ
,
XXLXOR
,
XXMRG
,
XXMRGHW
,
XXMRGLW
,
XXPERM
,
XXPERMDI
,
XXSEL
,
XXSI
,
XXSLDWI
,
XXSPLT
, and
XXSPLTW
.
The yacc
tool (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” repository 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
compiler 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
plugins written in Go, and a
new plugin
package for
loading such plugins at run time. Plugin support is only currently
available on Linux and macOS.
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 thoroughly 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.
The overhead of deferred function calls has been reduced by half.
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.
The HTTP Server now has support for graceful shutdown using the new
Server.Shutdown
method. The related and more abrupt
Server.Close
is also new.
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.
The zip Reader
now supports modification times in
the NTFS, UNIX, and Extended Time Stamp metadata fields.
When writing zip files, the Extended Time Stamp field is written
if TODO: validate implementation.
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, png, 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 slices passed to the
Write
method.
The decoder, upon encountering an error, now returns any buffered data it had uncompressed along with the error.
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 nonsensical 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 context.Context
. There are new methods
ending in Context
such as
DB.QueryContext
and
DB.PrepareContext
that support Context
. By using the new Context
methods it ensures
connections are closed and returned to the connection pool when the
request is done. It also enables canceling in-progress queries
should the driver support it. Finally, using the Context
methods allows the database pool to cancel waiting for the next
available connection.
The IsolationLevel
can now be set when starting a transaction by setting the isolation level
on the Context
then passing that Context
to
DB.BeginContext
.
An error will be returned if an isolation level is selected that the driver
does not support. A read-only attribute may also be set on the transaction
with ReadOnlyContext
Queries now expose the SQL column type information for drivers that support it.
Rows can return ColumnTypes
which can include SQL type information, column type lengths, and the Go type.
Multiple result sets are now supported on Rows. After
Rows.Next
returns false
Rows.NextResultSet
may be called to advance to the next result set. The existing Rows
should be continued to be used after it advances to the next result set.
NamedParam
may be used
as query arguments. The new function Param
helps create a NamedParam
more succinctly.
Drivers that support the new Pinger
interface can now check if the server is still alive when the the
DB.Ping
or DB.PingContext
is called.
The new Context
query methods work for all drivers, but
Context
cancelation is not responsive unless the driver has been
updated to used them. The other features require driver support in
database/sql/driver
.
Driver authors should review the new interfaces. Users of existing
driver should review the driver documentation to see what
it supports and any system specific documentation on each feature.
TODO: describe Issue 15345 and CL 22181, CL 22332, CL 22336
pkg debug/pe, method (*COFFSymbol) FullName(StringTable) (string, error) pkg debug/pe, method (StringTable) String(uint32) (string, error) pkg debug/pe, type File struct, COFFSymbols []COFFSymbol pkg debug/pe, type File struct, StringTable StringTable pkg debug/pe, type Reloc struct pkg debug/pe, type Reloc struct, SymbolTableIndex uint32 pkg debug/pe, type Reloc struct, Type uint16 pkg debug/pe, type Reloc struct, VirtualAddress uint32 pkg debug/pe, type Section struct, Relocs []Reloc pkg debug/pe, type StringTable []uint8
The new
Encoding.Strict
method returns an Encoding
that causes the decoder
to return an error when the trailing padding bits are not zero.
The package now supports boolean values. TODO: add docs in encoding/binary package, then link to package docs here.
UnmarshalTypeError
now includes the struct and field name.
A nil
Marshaler
now marshals as a JSON "null
" value.
A RawMessage
value now
marshals the same as its pointer type.
Marshal encodes floating-point numbers using the same format as in ES6,
preferring decimal (not exponential) notation for a wider range of values.
In particular, all floating-point integers up to 264 format the
same as the equivalent int64
representation.
Implementations
of Unmarshaler
are now called with the literal "null
" and can
decide how to handle it.
The PEM decoder is now strict about the format of the ending line.
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.
The new Rand.Uint64
method returns uint64
values. The
new Rand.Source64
interface describes sources capable of generating such values
directly; otherwise the Rand.Uint64
method
constructs a uint64
from two calls
to Rand.Source
's Int63
method.
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.
Server changes:
Server
adds configuration options
ReadHeaderTimeout
and IdleTimeout
and documents WriteTimeout
.
FileServer
and
ServeContent
now support HTTP If-Match
conditional requests,
in addition to the previous If-None-Match
support.
There are several additions to what a server's Handler
can do:
Context
returned
by Request.Context
is canceled if the underlying net.Conn
closes. For instance, if the user closes their browser in the
middle of a slow request, the Handler
can now
detect that the user is gone. This complements the
existing CloseNotifier
support.
TrailerPrefix
mechanism.
Handler
can now abort a response by panicking
with the error
ErrAbortHandler
.
Write
of zero bytes to a
ResponseWriter
is now defined as a
way to test whether a ResponseWriter
has been hijacked:
if so, the Write
returns
ErrHijacked
without printing an error
to the server's error log.
Client & Transport changes:
Client
now copies most request headers on redirect. Authentication-specific
headers are only sent to the same origin or subdomains thereof.
Cookies are not sent again, unless they were set explicitly.
TODO: verify this, and link to docs once https://github.com/golang/go/issues/18096
is fixed.
Transport
now supports international domain names. Consequently, so do
Get and other helpers.
Client
now supports 307 and 308 redirects.
If the redirect requires resending the request body,
the request must have the new
Request.GetBody
field defined.
NewRequest
sets Request.GetBody
automatically for common
body types.
Transport
now rejects requests for URLs with
ports containing non-digit characters.
Transport
will now retry non-idempotent
requests if no bytes were written before a network failure.
Transport.ProxyConnectHeader
allows configuration of header values to send to a proxy
during a CONNECT
request.
DefaultTransport.Dialer
now enables DualStack
("Happy Eyeballs") support,
to use IPv4 as a backup if it looks like IPv6 might be
failing.
Empty quoted strings are once again allowed in the name part of
an address. That is, Go 1.4 and earlier accepted
"" <gopher@example.com>
,
but Go 1.5 introduced a bug that rejected this address.
The address is recognized again.
The
Header.Date
method has always provided a way to parse
the Date:
header.
A new function
ParseDate
allows parsing dates found in other
header lines, such as the Resent-Date:
header.
If an implementation of
the Auth
interface's Start
method returns an
empty toServer
value, the package no longer sends
trailing whitespace in the SMTP AUTH
command,
which some servers rejected.
The new functions
PathEscape
and
PathUnescape
are similar to the query escaping and unescaping functions but
for path elements.
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
,
making it possible to process URLs in gob data.
Following RFC 3986,
Parse
now rejects URLs like this_that:other/thing
instead of
interpreting them as relative paths (this_that
is not a valid scheme).
To force interpretation as a relative path,
such URLs should be prefixed with "./"
.
The URL.String
method now inserts this prefix as needed.
The new function
Executable
returns
the running executable path name.
The new function
Swapper
was
added to support sort.Slice
.
The Unquote
function now strips carriage returns (\r
) in
backquoted raw strings, following the
Go language semantics.
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 tzdata
database has been updated to version
2016i for systems that don't already have a local time zone
database.
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 the test coverage mode.
Tests and benchmarks are now marked as failed if the race detector is enabled and a data race occurs during execution. Previously, individual test cases would appear to pass, and only the overall execution of the test binary would fail.
SimpleFold
now returns its argument unchanged
if the provided input was an invalid rune.
Previously, the implementation failed with an index bounds check panic.