MacMusic  |  PcMusic  |  440 Software  |  440 Forums  |  440TV  |  Zicos
type
Search

Go 1.24 arrives with generic type aliases, boosted WebAssembly support

Thursday December 19, 2024. 10:00 AM , from InfoWorld
Go 1.24, an update to Google‘s popular open source programming language, is now generally available as a production release, with full backing for generic type aliases, performance improvements, and improved WebAssembly support. The release was unveiled February 11, and can be downloaded from Go.dev. Previously, a release candidate was published in mid-December.

Release notes for Go 1.24 note that the release brings full support for generic type aliases, in which a type alias may be parameterized like a defined type. For now, generic type aliases can be disabled by setting GOEXPERIMENT=noaliastypeparams. This parameter setting will be removed in Go 1.25.

For WebAssembly, Go 1.24 offers a go:wasmexport directive for Go programs to export functions to the WebAssembly host. The release also supports building a Go program as a WASI reactor/library.

With the go command in Go 1.24, Go modules now can track executable dependencies using tool directives in go.mod files. This removes the need for a previous workaround of adding tools as blank imports to a file conventionally named tools.go. The go tool command now can run these tools in addition to tools shipped with the Go distribution. Also with the go command, a new GOAUTH environment variable offers a flexible way to authenticate private module fetches.

Cgo, for creating Go packages that call C code, now supports new annotations for C functions to improve runtime performance. With these improvements, #cgo noescape cFunctionName tells the compiler that memory passed to the C function cFunctionName does not escape. Also, #cgo nocallback cFunctionName tells the compiler that the C function cFunctionName does not call back to any Go functions.

Other new features and improvements in Go 1.24:

Multiple performance improvements to the runtime in Go 1.24 have decreased CPU overheads by 2% to 3% on average across a suite of representative benchmarks. These include a new builtin map implementation based on Swiss Tables, more efficient memory allocation of small objects, and a new runtime-internal mutex implementation.

A new tests analyzer reports common mistakes in declarations of tests, fuzzers, benchmarks, and examples in test packages, such as incorrect signatures, or examples that document non-existent identifiers. Some of these mistakes might cause tests not to run.

The cmd/go internal binary and test caching mechanism now can be implemented by child processes implementing a JSON protocol between the cmd/go tool and the child process named by the GOCACHEPROG environment variable.

An experimental testing/synctest package supports testing concurrent code.

The debug/elf package offers support for handling symbol versions in dynamic ELF (Executable and Linkable Format) files.

For Linux, Go 1.24 requires Linux kernel version 3.2 or later.

Go 1.24 follows Go 1.23, released in August 2024, featuring reduced build times for profile-guided optimization.
https://www.infoworld.com/article/3627904/go-1-24-brings-full-support-for-generic-type-aliases.html

Related News

News copyright owned by their original publishers | Copyright © 2004 - 2025 Zicos / 440Network
Current Date
Feb, Sat 22 - 18:44 CET