go/doc/next/3-tools.md
Michael Matloob 8e2b3ac705 cmd/go: add release notes for go telemetry, and telemetry env values
This change fills in the release notes for the go telemetry command as
well as the unsettable GOTELEMETRY and GOTELEMETRYDIR go env values.

For #67111

Change-Id: Id6943f79f7ab2457787e1639d8d5fb1c1e2649dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/587923
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-28 19:06:07 +00:00

3.4 KiB

Tools

Go command

Setting the GOROOT_FINAL environment variable no longer has an effect (#62047). Distributions that install the go command to a location other than $GOROOT/bin/go should install a symlink instead of relocating or copying the go binary.

The new go env -changed flag causes the command to print only those settings whose effective value differs from the default value that would be obtained in an empty environment with no prior uses of the -w flag.

The new go mod tidy -diff flag causes the command not to modify the files but instead print the necessary changes as a unified diff. It exits with a non-zero code if updates are needed.

The go list -m -json command now includes new Sum and GoModSum fields. This is similar to the existing behavior of the go mod download -json command.

The new go telemetry command can be used to view and configure the telemetry collection mode. Without arguments, it displays the current mode. With local, on, or off, it sets the collection mode. go env now lists two values: the GOTELEMETRY value, which contains the telemetry collection mode, and the GOTELEMETRYDIR value setting which contains the directory telemetry data and configuration are written to.

Vet

The go vet subcommand now includes the stdversion analyzer, which flags references to symbols that are too new for the version of Go in effect in the referring file. (The effective version is determined by the go directive in the file's enclosing go.mod file, and by any //go:build constraints in the file.)

For example, it will report a diagnostic for a reference to the reflect.TypeFor function (introduced in go1.22) from a file in a module whose go.mod file specifies go 1.21.

Cgo

[cmd/cgo] supports the new -ldflags flag for passing flags to the C linker. The go command uses it automatically, avoiding "argument list too long" errors with a very large CGO_LDFLAGS.

Trace

The trace tool now better tolerates partially broken traces by attempting to recover what trace data it can. This functionality is particularly helpful when viewing a trace that was collected during a program crash, since the trace data leading up to the crash will now be recoverable under most circumstances.