Go 1.18 beta 1 is available with generics


Go 1.18 beta 1 is now available, which is the first preview of go 1.18; The official release of go 1.18 will take several months.

Interested users can visit the download page to get go 1.18 beta 1.

Go 1.18 beta 1 is the first preview version to include go’s new support for generic code that uses parameterized types. Officials say that generics is the most important change in go since the release of go 1, and it is also the largest single language change they have made.

For any large-scale new function, it is common for new users to find new errors, and we don’t want generics to be an exception to this rule; They must be treated with appropriate caution. In addition, some subtle situations, such as recursive generic types of specific types, have been postponed to future versions. In other words, we know that some early adopters are quite satisfied. If you have a use case that you think is particularly suitable for generics, we hope you can try it. We posted a short tutorial on how to get started using generics and gave a speech at gophercon last week. You can even try it in go dev branch mode of go playground.

In addition, go 1.18 beta 1 includes:

  • Added built-in support for writing fuzzy based tests to automatically find inputs that cause the program to crash or return invalid answers.
  • A new “go workspace mode” has been added, which allows users to use multiple go modules at the same time, which is an important use case for large projects.
  • Contains an extended go version – M command, which can now record build details such as compiler flags. The program can use debug Readbuildinfo queries its own build details, and you can now read the build details from other binaries using the new debug / buildinfo package. This function is intended to be the basis for any tool that needs to generate a software bill of materials (SBOM) for the go binary.
  • Go 1.17 has added a new register based calling convention to speed up go code on x86-64 systems. Go 1.18 beta 1 extends this feature to arm64 and ppc64, increasing the speed by 20%.

More details can be found on the official blog: https://go.dev/blog/go1.18beta1

Address: https://www.oschina.net/news/173774/go-1-18-beta1-released