Module support is the big thing in latest version of Google’s cloud-tastic language Go

Go cloud computing

Docker, Kubernetes, Prometheus – most of the major containerisation infrastructure projects are written in Google’s programming language Go. A new release is therefore always worth looking into.

Newly available Version 1.11 is the first to contain experimental support for the so-called module concept. It is described as an alternative to GOPATH and is supposed to create more reliable and reproducible builds. Modules include lightweight version dependency information and package distribution support. Since it’s still in its early days, the addition is likely to see changes with the next release. Nevertheless, the documentation promises that converted projects will continue to work with Go 1.12 and later versions.

To locate and load Go source code packages, Go 1.11 offers a new tool called packages. The tool replaces go/build in a number of ways, because the API of the older package isn’t fully capable of working with modules. Users building custom GOPATH trees by means other than go get will run into problems importing paths containing the @-symbol. The latter is now disallowed when using the go command, since the module support assigns special meaning to the symbol in command line operations.

Another experimental addition is the port to WebAssembly. With it, Go programs can be compiled to WebAssembly modules that include the language’s runtime. To be able to call into JavaScript, there’s also a syscall/js package available. Go’s compiler toolchain can now handle column information in line directives and uses a new package export data format. It also produces better debugging information for optimised binaries and does a few optimisation steps to make programs run faster. A user annotation API offers a way to record application level information in execution traces and group goroutines.

Advertisement

The language specification remains unchanged and there are only minor updates in the core library. The runtime, however, comes with a new sparse heap layout, getting rid of the 512GiB Go heap limit. To help compatibility with future versions of macOS and iOS, it also stopped calling the kernel of those systems directly, but uses libSystem.so instead.

A bit more context

Go was Google’s attempt to combine the efficiency and safety of statically typed, compiled languages with the ease of programming of an interpreted, dynamically typed language. It is now especially popular in the cloud computing space, and sees more usage thanks to infrastructure projects such as Docker and Kubernetes. Docker’s developers decided on Go because of it being perceived as “neutral” and its static compilation, asynchronous primitives, low-level interfaces, and extensive standard library.

To promote the language’s usage for cloud projects even more, the Go team released a library and tools for developing portable cloud applications called Go Cloud in July 2018.

- Advertisement -