← All releases

go1.16.0

Major

February 16, 2021

Go 1.16 adds native file embedding (//go:embed, embed package) and a new io/fs filesystem abstraction, makes module mode the default, adds Apple Silicon (darwin/arm64) support, deprecates io/ioutil, and stops go build/test from silently editing go.mod/go.sum.

highlights
  • New //go:embed directive and embed package let you compile static files/trees directly into binaries

  • New io/fs package defines a standard read-only filesystem interface (fs.FS), adopted by embed.FS, zip.Reader, os.DirFS, net/http.FS, and template ParseFS

  • GO111MODULE now defaults to on, making module-aware mode the default everywhere, not just when go.mod is present

  • go build/go test no longer modify go.mod or go.sum automatically; they error instead (use go mod tidy or go get)

  • go install now accepts version suffixes (e.g. go install pkg@v1.0.0) and is the recommended way to install commands; using go get to build/install is deprecated

  • New go.mod retract directive lets module authors mark published versions as unusable

  • New GOVCS environment variable restricts which version control tools go can invoke, for supply-chain security

  • New darwin/arm64 port for Apple Silicon Macs; iOS port renamed darwin/arm64 to ios/arm64, plus new ios/amd64 simulator port; Go 1.16 is the last release supporting macOS 10.12

  • io/ioutil is effectively deprecated: Discard, ReadAll, ReadFile, WriteFile, ReadDir, TempDir, TempFile etc. moved to io and os packages

  • New runtime/metrics package supersedes runtime.ReadMemStats and debug.GCStats with a more general, efficient stable metrics API

  • Linker rework finished: linking is 20-25% faster and uses 5-15% less memory on linux/amd64, with bigger gains on other platforms, plus smaller binaries

  • vet now flags calls to t.Fatal/FailNow/Skip from spawned goroutines in tests, and warns about amd64 assembly that clobbers the BP frame-pointer register without saving it