Go 1.14, the latest version of the Google-developed open source programming language used to create Docker, Kubernetes, Istio, and other cloud-native computing projects, is now available as a production release.
The Go upgrade, released February 25, improves the runtime and compiler. Version 1.14 also will be the last to support 32-bit Apple platforms, according to release notes.
With the Go runtime improvements, the performance of most use cases of
defer has been boosted to incur nearly no overhead, compared to calling the deferred function directly. As a result,
defer now can be used in performance-critical code without overhead concerns.
The improved Go runtime also makes goroutines asynchronously pre-emptible. This means loops without function calls no longer potentially deadlock the scheduler or significantly delay garbage collection. This capability is supported on all platforms except
One consequence of the pre-emption implementation is that Go 1.14 programs on Linux and MacOS will receive more signals than earlier versions. Programs using packages such as
golang.org/x/sys/unix will see more slow system calls fail with
EINTR errors. These programs will have to handle those errors in some way, most likely by looping to try the system call again.
In addition, the page allocator is more efficient and incurs less lock contention at high values of
GOMAXPROCS. This will be most noticeable as lower latency and higher throughput for large allocations done in parallel and at a high rate.
The Go compiler, meanwhile, adds
-d=checkptr as a a compile-time option for checking that Go code is abiding by
unsafe.Pointer safety rules dynamically. Also, the compiler now can emit machine-readable logs of key optimizations using the
-json flag, including inlining and bounds-check elimination. Detailed escape analysis diagnostics now work again, and experimental support is offered for compiler-inserted coverage instrumentation for fuzzing.
Other changes and improvements in Go 1.14 include:
js.Valueobjects now can be garbage-collected. However,
js.Valueobjects no longer can be compared using the
==operator. They must instead be compared using the
- Similar to what is happening with the Rust language, the Go 1.14 release will be the last to support 32-bit binaries on MacOS. It will likely also be the last to support 32-bit binaries on other Apple platforms including iOS, iPadOS, WatchOS, and tvOS.
- In a language change, embedding of overlapping interfaces is now permitted.
- Support is discontinued for the Google Native Client platform
- The 64-bit architecture of FreeBSD is now supported.
gocommand now supports Subversion repos in module mode. This command also now has snippets of plain-text error messages from module proxies and other HTTP servers. An error message is shown only if it is valid UTF-8 and has only graphic characters and spaces.
- Binaries on Windows have Data Execution Prevention (DEP) enabled for system-level memory protection.
- A new flag,
-modfile=file, instructs the
gocommand to read and possibly write an alternative go.mod file rather than the one in the module root directory.
go getcommand no longer accepts the
- A new flag,
-modcacherw, instructs the
gocommand to leave newly created directories in the module cache at default permissions rather than being read-only. This flag makes it more likely that tests or other tools will accidentally add files not in the module’s verified checksum. But it allows the use of
rm-rfto remove the module cache.
- A hash/maphash package provides hash functions on byte sequences.
GOINSECUREis a new environment variable that instructs the
gocommand to allow an HTTPS connection to skip certificate validation when fetching certain modules directly from their origins.
Go 1.14 can be downloaded from golang.org.
This story, “Go 1.14 improves runtime, compiler” was originally published by
Share this post if you enjoyed! 🙂