InfoQ Homepage   	  		  			  			                  News                 		  		Go 1.18 Stabilizes Generics, Fuzzing, Multi-Module Support, and Improv

Go 1.18 Stabilizes Generics, Fuzzing, Multi-Module Support, and Improves Performance

submited by
Style Pass
2022-05-11 23:00:08

InfoQ Homepage News Go 1.18 Stabilizes Generics, Fuzzing, Multi-Module Support, and Improves Performance

The Go team has announced the release of Go 1.18, which brings support for generics, fuzzing, workspaces, and performance improvements.

The generics implementation provided by Go 1.18 follows the type parameter proposal and allows developers to add optional type parameters to type and function declarations. InfoQ has already covered the basic syntax of generics in Go when they first become available in Go 1.18 beta 1. In a nutshell, this is how you can define a function that works on a generic map:

The current generics design only supports a number of use cases, which should address the needs of the "majority of users". The Go team will continue their work on generics to support more advanced use cases in future releases. As pointed out by Michael Ernst, some of the current limitations can be circumvented, albeit at the expense of code cleanness and clarity.

While Go generics in 1.18 are considered stable, the Go team cannot rule out the possibility of bugs, not only at the implementation level but also in the design and specification.

Leave a Comment