days
0
-24
-4
hours
-2
-2
minutes
-2
-7
seconds
-1
-6
search
Wake me up before you Golang

Go 1.14: Module support in the go command is production-ready

Sarah Schlothauer
#go
golang
© Shutterstock / SERGEI BRIK

Every six months, a new Golang release arrives. Go 1.14 is here and it includes some changes to the language, as well as improved defer performance and a more efficient page allocator. With 1.14, module support in the Go command is now officially ready for use in production. Users are now strongly encouraged to migrate to go modules.

On February 25, 2020 the Go team released the latest version of the language with Golang 1.14. This release arrives right on time, six months after 1.13 and continues to maintain Go version 1 compatibility.

It includes changes in the implementation of the toolchain, runtime, and libraries as well as some changes to the language and performance upgrades.

Production-ready module support in the go command

With this release, module support in the  go command is now ready for use in production.

In the 1.14 announcement blog, the Go team recommends that with this update, all users should migrate go modules for dependency management. Read about how to migrate to Go modules in your projects here.

SEE ALSO: How Curve is getting ahead with Golang

In order to migrate, your project must either be a new Go project, an established project with a non-modules dependency manager, or an established project without any dependency manager. Users can report any issues during this process on GitHub.

Embedded overlapping interfaces

The language itself receives a change. From the release notes:

Per the overlapping interfaces proposal, Go 1.14 now permits embedding of interfaces with overlapping method sets: methods from an embedded interface may have the same names and identical signatures as methods already present in the (embedding) interface. This solves problems that typically (but not exclusively) occur with diamond-shaped embedding graphs. Explicitly declared methods in an interface must remain unique, as before.

View the proposal authored by Robert Griesemer and the feature’s discussion.

Runtime changes

1.14 improves the performance of defer uses. Now, the overhead has been reduced to nearly zero and users can use defer in their production-critical code without having to worry about performance.

In addition to this, goroutines are now asynchronously preemptible. Programs built with Golang 1.14 will receive more signals on Unix systems, including Linux and macOS systems, as compared to programs built with older releases.

Internal timers have been made more efficient, which should cause performance improvements without any visible changes. The page allocator also received an efficiency update.

Miscellaneous updates & improvements

Besides the aforementioned highlights, here are some additional changes that 1.14 makes:

  • New package: hash/maphash
  • go command includes plain-text error message snippets
  • Support for SSL version 3.0 removed
  • For macOS binaries, Go symbols now all begin with an underscore
  • New environmental variable: GOINSECURE
  • New default option: -d=checkptr as a compile-time option when adding instrumentation for checking to see if Go code is following unsafe.Pointer safety rules. (Not currently recommended for Windows systems.)
  • Upgraded Unicode 11.0 to Unicode 12.0
  • Added support for 64-bit ARM on FreeBSD 12.0 or later
  • Testing package supports cleanup functions
  • Decoder type supports  InputOffset

View the full release notes for additional information on what Go 1.14 includes.

SEE ALSO: Go turns 10: What does the next decade have in store?

Download 1.14

Upgrade to the latest release from the downloads page. Follow the instructions to get started and test out the newest features.

A new version of Golang is projected to release every six months. View the proposals for the next version, Go 1.15, scheduled for an August 2020 release. Go 1.15 will require macOS 10.12 Sierra or later.

Author
Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is an assistant editor for JAXenter.com. She received her Bachelor's degree from Monmouth University and is currently enrolled at Goethe University in Frankfurt, Germany where she is working on her Masters. She lives in Frankfurt with her husband and cat. She is also the editor for Conditio Humana, an online magazine about ethics, AI, and technology.

Leave a Reply

avatar
400