зеркало из https://github.com/golang/tools.git
go/analysis/passes/stdversion: publish
This CL moves the stdversion analyzer out of gopls, into the exported analyzer tree, whence it will be vendored into cmd/vet in a follow-up. Updates golang/go#46136 Change-Id: I039ef78ecdcfd6bc64d5b089017a9b8635cf9aa5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/572035 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Tim King <taking@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Родитель
8669bfccbe
Коммит
6af02955c9
|
@ -9,7 +9,7 @@ package main
|
|||
|
||||
import (
|
||||
"golang.org/x/tools/go/analysis/singlechecker"
|
||||
"golang.org/x/tools/gopls/internal/analysis/stdversion"
|
||||
"golang.org/x/tools/go/analysis/passes/stdversion"
|
||||
)
|
||||
|
||||
func main() { singlechecker.Main(stdversion.Analyzer) }
|
|
@ -37,7 +37,7 @@ var Analyzer = &analysis.Analyzer{
|
|||
Name: "stdversion",
|
||||
Doc: Doc,
|
||||
Requires: []*analysis.Analyzer{inspect.Analyzer},
|
||||
URL: "https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/stdversion",
|
||||
URL: "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/stdversion",
|
||||
RunDespiteErrors: true,
|
||||
Run: run,
|
||||
}
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
"golang.org/x/tools/go/analysis"
|
||||
"golang.org/x/tools/go/analysis/analysistest"
|
||||
"golang.org/x/tools/gopls/internal/analysis/stdversion"
|
||||
"golang.org/x/tools/go/analysis/passes/stdversion"
|
||||
"golang.org/x/tools/internal/testenv"
|
||||
"golang.org/x/tools/txtar"
|
||||
)
|
|
@ -33,6 +33,7 @@ import (
|
|||
"golang.org/x/tools/go/analysis/passes/shift"
|
||||
"golang.org/x/tools/go/analysis/passes/sigchanyzer"
|
||||
"golang.org/x/tools/go/analysis/passes/stdmethods"
|
||||
"golang.org/x/tools/go/analysis/passes/stdversion"
|
||||
"golang.org/x/tools/go/analysis/passes/stringintconv"
|
||||
"golang.org/x/tools/go/analysis/passes/structtag"
|
||||
"golang.org/x/tools/go/analysis/passes/testinggoroutine"
|
||||
|
@ -70,6 +71,7 @@ func vet() {
|
|||
shift.Analyzer,
|
||||
sigchanyzer.Analyzer,
|
||||
stdmethods.Analyzer,
|
||||
stdversion.Analyzer,
|
||||
stringintconv.Analyzer,
|
||||
structtag.Analyzer,
|
||||
testinggoroutine.Analyzer,
|
||||
|
|
|
@ -739,7 +739,7 @@ have false positives, for example if fields or methods are accessed
|
|||
through a type alias that is guarded by a Go version constraint.
|
||||
|
||||
|
||||
[Full documentation](https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/stdversion)
|
||||
[Full documentation](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/stdversion)
|
||||
|
||||
**Enabled by default.**
|
||||
|
||||
|
|
|
@ -1193,7 +1193,7 @@ var GeneratedAPIJSON = &APIJSON{
|
|||
{
|
||||
Name: "stdversion",
|
||||
Doc: "report uses of too-new standard library symbols\n\nThe stdversion analyzer reports references to symbols in the standard\nlibrary that were introduced by a Go release higher than the one in\nforce in the referring file. (Recall that the file's Go version is\ndefined by the 'go' directive its module's go.mod file, or by a\n\"//go:build go1.X\" build tag at the top of the file.)\n\nThe analyzer does not report a diagnostic for a reference to a \"too\nnew\" field or method of a type that is itself \"too new\", as this may\nhave false positives, for example if fields or methods are accessed\nthrough a type alias that is guarded by a Go version constraint.\n",
|
||||
URL: "https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/stdversion",
|
||||
URL: "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/stdversion",
|
||||
Default: true,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ import (
|
|||
"golang.org/x/tools/go/analysis/passes/slog"
|
||||
"golang.org/x/tools/go/analysis/passes/sortslice"
|
||||
"golang.org/x/tools/go/analysis/passes/stdmethods"
|
||||
"golang.org/x/tools/go/analysis/passes/stdversion"
|
||||
"golang.org/x/tools/go/analysis/passes/stringintconv"
|
||||
"golang.org/x/tools/go/analysis/passes/structtag"
|
||||
"golang.org/x/tools/go/analysis/passes/testinggoroutine"
|
||||
|
@ -60,7 +61,6 @@ import (
|
|||
"golang.org/x/tools/gopls/internal/analysis/simplifycompositelit"
|
||||
"golang.org/x/tools/gopls/internal/analysis/simplifyrange"
|
||||
"golang.org/x/tools/gopls/internal/analysis/simplifyslice"
|
||||
"golang.org/x/tools/gopls/internal/analysis/stdversion"
|
||||
"golang.org/x/tools/gopls/internal/analysis/stubmethods"
|
||||
"golang.org/x/tools/gopls/internal/analysis/undeclaredname"
|
||||
"golang.org/x/tools/gopls/internal/analysis/unusedparams"
|
||||
|
|
|
@ -3,7 +3,7 @@ Test of "too new" diagnostics from the stdversion analyzer.
|
|||
This test references go1.21 symbols from std, but the analyzer itself
|
||||
depends on the the go1.22 behavior of versions.FileVersion.
|
||||
|
||||
See also gopls/internal/analysis/stdversion/testdata/test.txtar,
|
||||
See also go/analysis/passes/stdversion/testdata/test.txtar,
|
||||
which runs the same test in the analysistest framework.
|
||||
|
||||
-- flags --
|
||||
|
|
Загрузка…
Ссылка в новой задаче