Skip to content

Commit

Permalink
go/analysis/passes/stdversion: publish
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Tim King <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
  • Loading branch information
adonovan authored and gopherbot committed Mar 18, 2024
1 parent 8669bfc commit 6af0295
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 2 additions & 0 deletions go/analysis/unitchecker/vet_std_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -70,6 +71,7 @@ func vet() {
shift.Analyzer,
sigchanyzer.Analyzer,
stdmethods.Analyzer,
stdversion.Analyzer,
stringintconv.Analyzer,
structtag.Analyzer,
testinggoroutine.Analyzer,
Expand Down
2 changes: 1 addition & 1 deletion gopls/doc/analyzers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.**

Expand Down
2 changes: 1 addition & 1 deletion gopls/internal/settings/api_json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gopls/internal/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 --
Expand Down

0 comments on commit 6af0295

Please sign in to comment.