From the rooftops shout it out: Go 1.16 ready to go (onto more 64-bit architectures)


Go 1.16, the latest iteration of the programming language used in infrastructure projects like Docker and Kubernetes, has been released, and adds support for 64-bit ARM architecture on macOS as well as packages to facilitate file bundling and accessing metrics.

With no language changes present in the release, the embed package which is now part of the core library is amongst the more stand-out features of Go 1.16. Once imported, a program can use the package via the //go:embed directive followed by a variable declaration (string type, or a slice of a byte type, or FS) to embed files and work with their contents.

Another useful addition is the metrics package, which was introduced to provide a more general way to “access implementation-defined metrics exported by the Go runtime”. The runtime was also reworked to emit for each package init a line featuring execution time and memory allocation to standard error when the GODEBUG environment variable is set to inittrace=1. This can help to find bottlenecks and optimise code amongst other things. 

Devs that have been using GODEBUG=madvdontneed=1 to keep track of memory usage can skip setting the variable in Go 1.16, because the runtime has been adjusted to release memory promptly by default. 


Speaking of standard behaviour, the new release comes with the GO111MODULE environment variable enabled by default and build commands no longer altering go.mod and go.sum. Requirements or checksums can be adjusted with go mod tidy or go get with go build, go test, and the like throwing errors if that step has been missed.

Compiler and linker have seen some improvements as well, apparently bringing down the time and resources required to produce a Go program’s binary.

Go 1.16 is the first version to work on Apple Silicon (via GOOS=darwin, GOARCH=arm64) and the MIPS64 architecture on OpenBSD. While the latter doesn’t support cgo yet, the macOS ARM64 is already further developed and knows its way around “cgo, internal and external linking, c-archive, c-shared, and pie build modes, and the race detector”. The iOS port has meanwhile been renamed to ios/arm64 to avoid confusion.

Developers interested in upcoming language features can check out a recent proposal for adding generics to Go. The associated issue has progressed into the final comment period, so any showstopping concerns should be voiced now in order to get addressed in time. A first implementation is planned to land by the end of the year, probably as part of the beta phase of Go 1.18.

- Advertisement -