Go 1.9 is not yet released. These are work-in-progress release notes. Go 1.9 is expected to be released in August 2017.
The latest Go release, version 1.9, arrives six months after Go 1.8 and is the tenth release in the Go 1.x series. There is one change to the language, adding support for type aliases. Most of the changes are in the implementation of the toolchain, runtime, and libraries. 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 transparent monotonic time support, parallelizes compilation of functions within a package, better supports test helper functions, and includes a new bit manipulation package.
There is one change to the language. Go now supports type aliases to support gradual code repair while moving a type between packages. The type alias design document and an article on refactoring cover the problem in detail. In short, a type alias declaration has the form:
type T1 = T2
This declaration introduces an alias name T1
—an
alternate spelling—for the type denoted by T2
; that is,
both T1
and T2
denote the same type.
There are no new supported operating systems or processor architectures in this release.
Both GOARCH=ppc64
and GOARCH=ppc64le
now
require at least Power8 support. In previous releases,
only GOARCH=ppc64le
required Power8 and the big
endian ppc64
architecture supported older
hardware.
There are some instabilities on FreeBSD that are known but not understood. These can lead to program crashes in rare cases. See issue 15658. Any help in solving this FreeBSD-specific issue would be appreciated.
The Go compiler now supports compiling a package's functions in parallel, taking
advantage of multiple cores. This is in addition to the go
command's
existing support for parallel compilation of separate packages.
Parallel compilation is on by default, but can be disabled by setting the
environment variable GO19CONCURRENTCOMPILATION
to 0
.
Complex division is now C99-compatible. This has always been the case in gccgo and is now fixed in the gc toolchain.
The linker will now generate DWARF information for cgo executables on Windows.
The go
test
command accepts a new -list
flag, which takes a regular
expression as an argument and prints to stdout the name of any
tests, benchmarks, or examples that match it, without running them.
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, better generated code, and optimizations in the core library.
TODO: There have been significant optimizations bringing more than 10% improvements
to implementations in the
foo
,
bar
,
and
quux
packages.
Library functions that used to trigger stop-the-world garbage
collection now trigger concurrent garbage collection.
Specifically, runtime.GC
,
debug.SetGCPercent
,
and
debug.FreeOSMemory
,
now trigger concurrent garbage collection, blocking only the calling
goroutine until the garbage collection is done.
The
debug.SetGCPercent
function only triggers a garbage collection if one is immediately
necessary because of the new GOGC value.
This makes it possible to adjust GOGC on-the-fly.
Large object allocation performance is significantly improved in applications using large (>50GB) heaps containing many large objects.
The runtime.ReadMemStats
function now takes less than 100µs even for very large heaps.
The time
package now transparently
tracks monotonic time in each Time
value, making computing durations between two Time
values
a safe operation in the presence of wall clock adjustments.
See the package docs and
design document
for details.
Go 1.9 includes a new package,
math/bits
, with optimized
implementations for manipulating bits. On most architectures
functions in this package are additionally recognized by the
compiler and treated as intrinsics for additional performance.
The
new (*T).Helper
an (*B).Helper
methods mark the calling function as a test helper function. When
printing file and line information, that function will be skipped.
This permits writing test helper functions while still having useful
line numbers for users.
As always, there are various minor changes and updates to the library, made with the Go 1 promise of compatibility in mind.
TODO: https://golang.org/cl/39570: set utf-8 flag
TODO: https://golang.org/cl/36876: add BLAKE2b and BLAKE2s hash constants
TODO: https://golang.org/cl/38366: ARM assembly versions of encrypt, decrypt and expandKey
TODO: https://golang.org/cl/43852: use blocking getrandom call on Linux when supported
TODO: https://golang.org/cl/36093: load certs from env vars + extra locations
TODO: https://golang.org/cl/36900: support excluded domains in name constraints.
TODO: https://golang.org/cl/35476: proper prepared statement support in transactions
TODO: https://golang.org/cl/39031: support scanning into user defined string types
TODO: https://golang.org/cl/40694: allow using a single connection from the database
TODO: https://golang.org/cl/44017: heuristically handle both UNIX and Windows paths
TODO: https://golang.org/cl/38660: add NullBytes and NullRawValue for working with ASN.1 NULL
TODO: https://golang.org/cl/38634: add Encoding.WithPadding, StdPadding, NoPadding
TODO: https://golang.org/cl/39203: speedup decoding of maps by zeroing values
TODO: https://golang.org/cl/37051: support sharp flag for float and complex value printing
TODO: https://golang.org/cl/44291: make -I/-L options in cgo flags absolute
TODO: https://golang.org/cl/38356: add 128-bit FNV hash support
TODO: https://golang.org/cl/37880: panic if predefined escapers are found in pipelines during rewriting
TODO: https://golang.org/cl/40936: allow safe usage of predefined escapers in pipelines
The Rectangle.Intersect
method now returns a zero Rectangle
when called on
adjacent but non-overlapping rectangles, as documented. In
earlier releases it would incorrectly return an empty but
non-zero Rectangle
.
The YCbCr to RGBA conversion formula has been tweaked to ensure that rounding adjustments span the complete [0, 0xffff] RGBA range.
The new Encoder.BufferPool
field allows specifying an EncoderBufferPool
,
that will be used by the encoder to get temporary EncoderBuffer
buffers when encoding a PNG image.
The use of a BufferPool
reduces the number of
memory allocations performed while encoding multiple images.
The package now supports the decoding of transparent 8-bit grayscale ("Gray8") images.
TODO: https://golang.org/cl/36487: add IsInt64/IsUint64 predicates
TODO: https://golang.org/cl/39223: add Size to FileHeader
TODO: https://golang.org/cl/32572: add Resolver.StrictErrors
TODO: https://golang.org/cl/37260: allow Resolver to use a custom dialer
TODO: https://golang.org/cl/37402: implement deadline functionality on Pipe
TODO: https://golang.org/cl/40510: don't enclose non-literal IPv6 addresses in square brackets
TODO: https://golang.org/cl/40512: validate network in Dial{,IP} and Listen{Packet,IP} for IP networks
TODO: https://golang.org/cl/35488: add support for socks5 proxy
TODO: https://golang.org/cl/38194: strip port from host in mux Handler
TODO: https://golang.org/cl/43231: for http2, use the priority write scheduler by default
TODO: https://golang.org/cl/40012: expose cgi env vars in request context
TODO: https://golang.org/cl/34639: add Client and Certificate to Server
TODO: https://golang.org/cl/38474: Create empty maps and slices as return type
TODO: https://golang.org/cl/37915: parse command line without shell32.dll
TODO: https://golang.org/cl/41830: do not report ModeDir for symlinks on windows
TODO: https://golang.org/cl/37586: remove duplicate environment variables in Cmd.Start
TODO: https://golang.org/cl/33713: add Go implementation of LookupGroup, LookupGroupId
TODO: https://golang.org/cl/37664: add non-cgo versions of Lookup, LookupId
TODO: https://golang.org/cl/38335: Add MakeMapWithSize for creating maps with size hint
Tracebacks generated by the runtime and recorded in profiles are
now accurate in the presence of inlining.
To retrieve tracebacks programmatically, applications should use
runtime.CallersFrames
rather than directly iterating over the results of
runtime.Callers
.
On Windows, Go no longer forces the system timer to run at high resolution when the program is idle. This should reduce the impact of Go programs on battery life.
On FreeBSD, GOMAXPROCS
and
runtime.NumCPU
are now based on the process' CPU mask, rather than the total
number of CPUs.
The runtime has preliminary support for Android O.
TODO: https://golang.org/cl/34198: add definitions of profile label types
The execution trace now displays mark assist events, which indicate when an application goroutine is forced to assist garbage collection because it is allocating too quickly.
"Sweep" events now encompass the entire process of finding free space for an allocation, rather than recording each individual span that is swept. This reduces allocation latency when tracing allocation-heavy programs. The sweep event shows how many bytes were swept and how many were reclaimed.
TODO: https://golang.org/cl/34310: make Mutex more fair
TODO: https://golang.org/cl/36617: import Map from x/sync/syncmap
TODO: https://golang.org/cl/36697: only call setgroups if we need to
TODO: https://golang.org/cl/37439: use CLONE_VFORK and CLONE_VM
TODO: https://golang.org/cl/37913: add Conn and RawConn interfaces
The package now chooses values in the full range when
generating int64
and uint64
random
numbers; in earlier releases generated values were always
limited to the [-262, 262) range.
TODO: https://golang.org/cl/38420: fix handling of empty blocks
TODO: https://golang.org/cl/36615: add Duration.Truncate and Duration.Round
Retrieving the time and sleeping now work correctly under Wine.