Original post

1.13 Beta 1 was announced and, with it, some language changes are coming to Go.

In this blog post, we’ll see how supports this new Go version. To learn more about all the new and changes in GoLand 2019.2, please see our EAP announcement blog posts.

These changes are related to Go’s migration to Go 2, which you can read about in the official Go blog post.

Let’s start with the first change, which is related to the number literals.

From Go 1.13, the following number literals will be valid:

  • 0b100 – binary literal
  • 0o427 – octal literal
  • 0x1p2 or 0x1p-2 – hexadecimal floating-point literals

These changes were made to better align Go with the other languages in the C family and help those familiar with C, C++, Java, PHP, JavaScript, etc. to represent these type of numbers in the source code.

In addition, _ (underscore) can now be used as a digit separator in number literals, to improve the readability of big numbers such as 1_000_000 instead of 1000000.

The screenshot below shows how the IDE will display these new numbers. Also, note how they will be represented when printed to screen.

Go 1.13 - number literals

To learn more about these changes, you can read the full proposal, Proposal: Go 2 Number Literal Changes.

The second change that is included in Go 1.13 is again related to numbers, but this time it’s about permitting signed integer as shift counts.

This change means that now it will be possible to skip the conversion from a signed integer to unsigned integer before using it as a shift count. It’s a quality-of-life change that will surely reduce friction when using shift counts.

Here’s an example of how this can now be performed:

Go 1.13 - shift counts

To learn more about these changes, read the full Proposal: Permit Signed Integers as Shift Counts for Go 2.

This concludes our short overview of the language changes in Go 1.13 and how they are supported in GoLand 2019.2. Speaking of which, you can already preview GoLand 2019.2 by joining its (Early Access Program)! Stay tuned for more updates on this, and as always, share your feedback with us via the comments section below, Twitter, or our issue tracker.