Paul Krill
Editor at Large

Go 1.15 arrives with smaller binary sizes

news
Aug 17, 20203 mins

New version of Google-built language brings compiler, runtime, and linker improvements

go pedestrian crossing briefcase green light business person icon
Credit: seraficus / Getty Images

Go 1.15, the latest version of Google’s popular open source, statically typed, compiled language, was published as a production release on August 11. Among the new capabilities is an enhanced compiler that produces smaller binary sizes. The runtime and linker also have been improved.

Typical binary sizes in Go 1.15 are reduced by about five percent compared to Go 1.14. This reduction is achieved by eliminating certain types of garbage collection metadata and more-aggressively eliminating unused type metadata.

In another compiler improvement, the toolchain now mitigates Intel CPU erratum SKX102 on GOARCH=amd64 by aligning functions to 32-byte boundaries and padding jump instructions. Although this padding increases binary sizes, this increase is more than compensated for by the release’s binary size improvements. Additionally, Go 1.15 adds a -spectre flag to the compiler and the assembler to enable Spectre CPU vulnerability mitigations, though the Go team advises that these should almost never be needed.

The compiler in Go 1.15 also now rejects //go: compiler directives that have no meaning for the declarations they are applied to, reporting a “misplaced compiler directive” error. These misspelled directives were broken previously, but were silently ignored by the compiler.

Instructions for downloading the Go 1.15 beta can be found at golang.org. Other improvements in Go 1.15, based on release notes, include:

  • The compiler’s -json optimization logging now reports large copies as greater than or equal to 128 bytes, and provides explanations of escape analysis decisions.
  • For the runtime, allocation of small objects now performs better at high counts and has lower worst-case latency. Further, non-blocking receives on closed channels now perform as well as non-blocking receives on open channels.
  • Substantial improvements have been made to the Go linker, reducing linker resource usage. For a representative set of large Go programs, linking was 20 percent faster and used 30 percent less memory on average, for ELF-based operating systems on AMD64 architectures, with more-modest improvements for other architecture/OS improvements. Key to the better linker performance are a newly redesigned object file format and a revamping of internal phases to boost concurrency. 
  • With the Go command, the GOPROXY environment now supports skipping proxies that return errors. Proxy URLs now can be separated with commas or pipe characters. Also, various flag parsing issues in go test and go vet have been fixed.
  • The core library now includes a package, time/tzdata, that permits embedding the time zone database into a program.
  • The vet tool now warns about conversions of the form string (x) where x has an integer type other than rune or byte. The vet tool also now warns about type assertions from one interface type to another interface type when the type assertion will always fail. 
  • Deprecated legacy behavior of treating the CommonName field on X.509 certificates as a host name when there are no Subject Alternative Names present is now disabled by default. 
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author