diff options
author | Alan Donovan <adonovan@google.com> | 2024-04-30 16:21:20 -0400 |
---|---|---|
committer | Alan Donovan <adonovan@google.com> | 2024-05-03 01:02:40 +0000 |
commit | 6defff500536c1210f526fcaaf3ae7f1005f0337 (patch) | |
tree | e1c4890d3191316a8988548ec495ba2f2a1ed335 /doc | |
parent | 344075d9369103a453add5acf3cb6d68057e8423 (diff) | |
download | go-6defff500536c1210f526fcaaf3ae7f1005f0337.tar.gz go-6defff500536c1210f526fcaaf3ae7f1005f0337.zip |
cmd/vet: add stdversion analyzer
+ release note, test
Fixes #46136
Change-Id: Ib157c5343dde379f8d6f67bdfa64b3f6a6432bab
Reviewed-on: https://go-review.googlesource.com/c/go/+/582556
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/next/3-tools.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/next/3-tools.md b/doc/next/3-tools.md index bdbe6c0771..c052f3b084 100644 --- a/doc/next/3-tools.md +++ b/doc/next/3-tools.md @@ -8,5 +8,19 @@ 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. +### Vet {#vet} + +The `go vet` subcommand now includes the +[stdversion](https://beta.pkg.go.dev/golang.org/x/tools/go/analysis/passes/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](https://pkg.go.dev/cmd/go#hdr-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 {#cgo} |