2 min Devops

Google releases Go 1.18 Beta with generic code

Google releases Go 1.18 Beta with generic code

Google previews the latest version of its Go programming language. Version 1.18 adds functionality for generic programming with so-called ‘parameterized’ types.

Accordin to Google, 1.18 brings the most significant changes to the programming language since Go’s release. The idea behind generics is to allow functionality for representing functions and data structures by type modification. This excludes the ‘generality’ allowed by defining an interface type as a way of abstracting the actual data being brought to a function.

Google disclaims that Go developers should be aware that the functionality will undoubtedly lead to new bugs. The organization advises approaching generics with caution.

In other news

The preview also has built-in support for writing ‘fuzzing-based’ tests. These tests can automatically find inputs that cause programs to crash or return invalid responses. Also, Go 1.18 Beta provides a new ‘Go workspace mode’. This allows programmers to work with multiple Go modules simultaneously. According to Google, this is especially useful for large projects.

Furthermore, version 1.18 Beta adds functionality with an ‘extended go version -m’ command. This command now stores details as compiler flags. Also, a program can directly query its own build details with the debug.ReadBuildInfo command.

Lastly, the register-based calling convention — made available in Go 1.17 — has been enriched. Whereas the functionality was previously only suitable for speeding up Go code on x86 and x64 systems, it now supports ARM64 and PPC64 based systems. This should provide up to 20 percent more speed.