Featured image of post Go released 1.17

Go released 1.17

On August 16, The Go Team releases a new version of Go Programming Language. Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Table of Content

Go 1.17 is released

The 16 of August 2021, the Go Team releases the version 1.17 of Go

This release brings additional improvements to the compiler, namely a new way of passing function arguments and results. This change has shown about a 5% performance improvement in Go programs and reduction in binary sizes of around 2% for amd64 platforms. Support for more platforms will come in future releases.

Go 1.17 also adds support for the 64-bit ARM architecture on Windows, letting gophers run Go natively on more devices.

What are the changes of this version?

Most of its changes are in the implementation of the toolchain, runtime, and libraries

Changes to the language

Go 1.17 includes three small enhancements to the language.

  • Conversions from slice to array pointer: An expression s of type [] may now be converted to array pointer type *[N]T. If a is the result of such a conversion, then corresponding indices that are in range refer to the same underlying elements: &a[i] == &s[i] for $0 <= i < N$. The conversion panics if len(s) is less than $N$.
  • unsafe.Add: unsafe.Add(ptr, len) adds len to ptr and returns the updated pointer unsafe.Pointer(uintptr(ptr) + uintptr(len)).
  • unsafe.Slice: For expression ptr of type *T, unsafe.Slice(ptr, len) returns a slice of type []T whose underlying array starts at ptr and whose length and capacity are len.

Other minor changes

  • It will require macOS 10.13 High Sierra or later
  • 64-bit ARM architecture on Windows is now supported, including CGO support.
  • The 64-bit MIPS architecture on OpenBSD (the openbsd/mips64 port) now supports cgo.
  • Go programs now maintain stack frame pointers on the 64-bit ARM architecture on all operating systems
  • loong64 GOARCH value reserved for future implementations.
  • Pruned module graphs in go 1.17 modules
go mod tidy -go=1.17
go mod tidy -compat=1.17
  • Module deprecation comments. Module authors may deprecate a module by adding a // Deprecated:comment to go.mod
  • The go command by default now suppresses SSH password prompts and Git Credential Manager prompts when fetching Git repositories using SSH, as it already did previously for other Git password prompts.
  • The go command now understands //go:build lines and prefers them over // +build lines. The new syntax uses boolean expressions, just like Go, and should be less error-prone.
  • gofmt (and go fmt) now synchronizes //go:build lines with // +build lines. If a file only has // +build lines, they will be moved to the appropriate location in the file, and matching //go:build lines will be added.
  • Go vet has a new warning for calling signal.Notify on unbuffered channels.
c := make(chan os.Signal)
// signals are sent on c before the channel is read from.
// This signal may be dropped as c is unbuffered.
signal.Notify(c, os.Interrupt)

Users of signal.Notify should use channels with sufficient buffer space to keep up with the expected signal rate.

  • New warnings for Is, As and Unwrap methods
  • The cover tool now uses an optimized parser from, which may be noticeably faster when parsing large coverage profiles.
  • The runtime/cgo package now provides a new facility that allows to turn any Go values to a safe representation that can be used to pass values between C and Go safely. See runtime/cgo.Handle for detailed information.
package main

#include <stdint.h> // for uintptr_t

extern void MyGoPrint(uintptr_t handle);
void myprint(uintptr_t handle);
import "C"
import "runtime/cgo"

//export MyGoPrint
func MyGoPrint(handle C.uintptr_t) {
	h := cgo.Handle(handle)
	val := h.Value().(string)

func main() {
	val := "hello Go"
	// Output: hello Go

and on the C side:

#include <stdint.h> // for uintptr_t

// A Go function
extern void MyGoPrint(uintptr_t handle);

// A C function
void myprint(uintptr_t handle) {
  • The crypto/ed25519 package has been rewritten, and all operations are now approximately twice as fast on amd64 and arm64. The observable behavior has not otherwise changed.
  • CurveParams methods now automatically invoke faster and safer dedicated implementations for known curves (P-224, P-256, and P-521) when available. Note that this is a best-effort approach and applications should avoid using the generic, not constant-time CurveParams methods and instead use dedicated Curve implementations such as P256. The P521 curve implementation has been rewritten using code generated by the fiat-crypto project, which is based on a formally-verified model of the arithmetic operations. It is now constant-time and three times faster on amd64 and arm64. The observable behavior has not otherwise changed.
  • The crypto/rand package now uses the getentropy syscall on macOS and the getrandom syscall on Solaris, Illumos, and DragonFlyBSD.
  • binary.Uvarint will stop reading after 10 bytes to avoid wasted computations. If more than 10 bytes are needed, the byte count returned is -11.
  • The math package now defines three more constants: MaxUint, MaxInt and MinInt. For 32-bit systems their values are $2^{32} - 1$, $2^{31} - 1$ and $-2^{31}$, respectively. For 64-bit systems their values are $2^{64} - 1$, $2^{63} - 1$ and $-2^{63}$, respectively.
  • Regarding to pprof, block profiles are no longer biased to favor infrequent long events over frequent short events.
  • The strconv package now uses Ulf Adams’s Ryū algorithm for formatting floating-point numbers. This algorithm improves performance on most inputs and is more than 99% faster on worst-case inputs.
  • atomic.Value now has Swap and CompareAndSwap methods that provide additional atomic operations.

You can check all changelog information at

💬 Share this post in social media

Thanks for checking this out and I hope you found the info useful! If you have any questions, don't hesitate to write me a comment below. And remember that if you like to see more content on, just let me know it and share this post with your colleges, co-workers, FFF, etc.

You are free to use the content, but mention the author (@MrSergioAnguita) and link the post!
Last updated on Oct 04, 2021 09:26 CEST
Please, don't try to hack this website servers. Guess why...