2024-01-22 11:20:07 -07:00
|
|
|
## Tools {#tools}
|
|
|
|
|
2024-06-07 16:13:06 -06:00
|
|
|
### Telemetry
|
|
|
|
|
|
|
|
<!-- go.dev/issue/58894, go.dev/issue/67111 -->
|
|
|
|
Starting in Go 1.23, the Go toolchain can collect usage and breakage
|
|
|
|
statistics that help the Go team understand how the Go toolchain is
|
|
|
|
used and how well it is working. We refer to these statistics as
|
|
|
|
[Go telemetry](/doc/telemetry).
|
|
|
|
|
|
|
|
Go telemetry is an _opt-in system_, controlled by the
|
|
|
|
[`go` `telemetry` command](/cmd/go/#hdr-Manage_telemetry_data_and_settings).
|
|
|
|
By default, the toolchain programs
|
|
|
|
collect statistics in counter files that can be inspected locally
|
|
|
|
but are otherwise unused (`go` `telemetry` `local`).
|
|
|
|
|
|
|
|
To help us keep Go working well and understand Go usage,
|
|
|
|
please consider opting in to Go telemetry by running
|
|
|
|
`go` `telemetry` `on`.
|
|
|
|
In that mode,
|
|
|
|
anonymous counter reports are uploaded to
|
|
|
|
[telemetry.go.dev](https://telemetry.go.dev) weekly,
|
|
|
|
where they are aggregated into graphs and also made
|
|
|
|
available for download by any Go contributors or users
|
|
|
|
wanting to analyze the data.
|
|
|
|
See “[Go Telemetry](/doc/telemetry)” for more details
|
|
|
|
about the Go Telemetry system.
|
|
|
|
|
2024-01-22 11:20:07 -07:00
|
|
|
### Go command {#go-command}
|
|
|
|
|
2023-11-05 02:35:12 -07:00
|
|
|
Setting the `GOROOT_FINAL` environment variable no longer has an effect
|
2024-05-22 09:40:09 -06:00
|
|
|
([#62047](/issue/62047)).
|
2023-11-05 02:35:12 -07:00
|
|
|
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.
|
|
|
|
|
2024-05-22 15:44:04 -06:00
|
|
|
<!-- go.dev/issue/34208, CL 563137, CL 586095 -->
|
|
|
|
The new `go` `env` `-changed` flag causes the command to print only
|
2024-05-09 16:11:00 -06:00
|
|
|
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.
|
|
|
|
|
2024-05-22 15:44:04 -06:00
|
|
|
<!-- go.dev/issue/27005, CL 585401 -->
|
|
|
|
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.
|
|
|
|
|
2024-05-23 08:11:35 -06:00
|
|
|
<!-- go.dev/issue/52792, CL 562775 -->
|
|
|
|
<!-- TODO: Improve this if 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.
|
|
|
|
|
|
|
|
<!-- go.dev/issue/65573 ("cmd/go: separate default GODEBUGs from go language version") -->
|
2024-06-07 16:13:06 -06:00
|
|
|
The new `godebug` directive in `go.mod` and `go.work` declares a
|
|
|
|
[GODEBUG setting](/doc/godebug) to apply for the work module or workspace in use.
|
2024-05-23 08:11:35 -06:00
|
|
|
|
2024-04-30 14:21:20 -06:00
|
|
|
### Vet {#vet}
|
|
|
|
|
2024-05-23 08:11:35 -06:00
|
|
|
<!-- go.dev/issue/46136 -->
|
2024-04-30 14:21:20 -06:00
|
|
|
The `go vet` subcommand now includes the
|
2024-05-22 09:40:09 -06:00
|
|
|
[stdversion](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/stdversion)
|
2024-04-30 14:21:20 -06:00
|
|
|
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
|
2024-06-07 16:13:06 -06:00
|
|
|
by any [`//go:build` constraints](/cmd/go#hdr-Build_constraints)
|
2024-04-30 14:21:20 -06:00
|
|
|
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`.
|
|
|
|
|
2024-01-22 11:20:07 -07:00
|
|
|
### Cgo {#cgo}
|
|
|
|
|
2024-05-23 08:11:35 -06:00
|
|
|
<!-- go.dev/issue/66456 -->
|
|
|
|
[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`.
|
2024-05-24 12:46:48 -06:00
|
|
|
|
|
|
|
### Trace {#trace}
|
|
|
|
|
|
|
|
<!-- go.dev/issue/65316 -->
|
|
|
|
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](/issue/65319) under most
|
|
|
|
circumstances.
|