
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: