Back

# 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.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
 1 go mod tidy -go=1.17
 1 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.
 1 2 3 4 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 golang.org/x/tools/cover, 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.
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 package main /* #include // 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) println(val) h.Delete() } func main() { val := "hello Go" C.myprint(C.uintptr_t(cgo.NewHandle(val))) // Output: hello Go }

and on the C side:

 1 2 3 4 5 6 7 8 9 #include // for uintptr_t // A Go function extern void MyGoPrint(uintptr_t handle); // A C function void myprint(uintptr_t handle) { MyGoPrint(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.