The countdown has begun

What to expect from Go 1.9

Gabriela Motroc
Go 1.9

© Shutterstock / weedezign

The Go releases go like clockwork — every six months, there’s a new release and 1.9 is almost here. Although most of the changes are in the implementation of the toolchain, runtime, and libraries, there is also one change to the language, adding support for type aliases.

Go 1.8 was released in February 2017 so we have two more months until the arrival of 1.9. According to the draft release notes, there is one change to the language, adding support for type aliases. However, most of the changes are in the implementation of the toolchain, runtime, and libraries. The release adds transparent monotonic time support, parallelizes compilation of functions within a package, better supports test helper functions, includes a new bit manipulation package, and has a new concurrent map type.

Type aliases

Back to the language change: Go now supports type aliases to support gradual code repair while moving a type between packages. The proposal to add type aliases support is a replacement for the generalized alias proposal originally targeted for, but held back from, the previous release.

Russ Cox and Robert Griesemer wrote in the proposal that “the primary motivation is to enable gradual code repair during large-scale refactorings, in particular moving a type from one package to another in such a way that code referring to the old name interoperates with code referring to the new name. Type aliases may also be useful for allowing large packages to be split into multiple implementation packages with a single top-level exported API, and for experimenting with extended versions of existing packages.”

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.

If you want to read more about this change, check out Codebase Refactoring (with help from Go).


Existing code continues to compile, in keeping with the compatibility guidelines.

In the libraries, there is a new field in go/ast’s TypeSpec, and there is a new type in go/types, namely types.Alias (details in the Implementation section below). These are both permitted changes at the library level. Code that cares about the semantics of Go types may need updating to handle aliases. This affects programming tools and is unavoidable with nearly any language change.

Go 1.9 — Overview


According to the draft release notes, “most programs should run a bit faster, due to speedups in the garbage collector, better generated code, and optimizations in the core library.”

Garbage Collector

Library functions which 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.

Furthermore, 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.


Parallel Compilation

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.

Vendor matching with ./…

./... no longer matches packages in vendor directories in tools accepting package names, such as go test. To match vendor directories, write ./vendor/....

Compiler Toolchain

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 compiler now includes lexical scopes in the generated DWARF, allowing debuggers to hide variables that are not in scope. The .debug_info section is now DWARF version 4.

The values of GOARM and GO386 now affect a compiled package’s build ID, as used by the go tool’s dependency caching.


Long lists of arguments are now truncated. This improves the readability of go doc on some generated code.

Viewing documentation on struct fields is now supported with go doc struct.field.


The new go env -json flag enables JSON output, instead of the default OS-specific output format.


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.


The go tool pprof command now uses the HTTP proxy information defined in the environment, usinghttp.ProxyFromEnvironment.


TODO: finish documenting misc tool changes

CL 42028: cmd/asm: fix operand order of ARM's MULA instruction
CL 40112: cmd/go: allow full flag processing in go vet
CL 42990: cmd/internal/obj/x86: add ADDSUBPS/PD
CL 40331: cmd/link,runtime/cgo: enable PT_TLS generation on OpenBSD

If you want to have a look at the entire list of changes, read the draft release notes


Gabriela Motroc
Gabriela Motroc was editor of and JAX Magazine. Before working at Software & Support Media Group, she studied International Communication Management at the Hague University of Applied Sciences.

Inline Feedbacks
View all comments