Skip to content

Commit 6af0295

Browse files
adonovangopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Tim King <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 8669bfc commit 6af0295

File tree

9 files changed

+9
-7
lines changed

9 files changed

+9
-7
lines changed

gopls/internal/analysis/stdversion/main.go renamed to go/analysis/passes/stdversion/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package main
99

1010
import (
1111
"golang.org/x/tools/go/analysis/singlechecker"
12-
"golang.org/x/tools/gopls/internal/analysis/stdversion"
12+
"golang.org/x/tools/go/analysis/passes/stdversion"
1313
)
1414

1515
func main() { singlechecker.Main(stdversion.Analyzer) }

gopls/internal/analysis/stdversion/stdversion.go renamed to go/analysis/passes/stdversion/stdversion.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var Analyzer = &analysis.Analyzer{
3737
Name: "stdversion",
3838
Doc: Doc,
3939
Requires: []*analysis.Analyzer{inspect.Analyzer},
40-
URL: "https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/stdversion",
40+
URL: "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/stdversion",
4141
RunDespiteErrors: true,
4242
Run: run,
4343
}

gopls/internal/analysis/stdversion/stdversion_test.go renamed to go/analysis/passes/stdversion/stdversion_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"golang.org/x/tools/go/analysis"
1313
"golang.org/x/tools/go/analysis/analysistest"
14-
"golang.org/x/tools/gopls/internal/analysis/stdversion"
14+
"golang.org/x/tools/go/analysis/passes/stdversion"
1515
"golang.org/x/tools/internal/testenv"
1616
"golang.org/x/tools/txtar"
1717
)

go/analysis/unitchecker/vet_std_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"golang.org/x/tools/go/analysis/passes/shift"
3434
"golang.org/x/tools/go/analysis/passes/sigchanyzer"
3535
"golang.org/x/tools/go/analysis/passes/stdmethods"
36+
"golang.org/x/tools/go/analysis/passes/stdversion"
3637
"golang.org/x/tools/go/analysis/passes/stringintconv"
3738
"golang.org/x/tools/go/analysis/passes/structtag"
3839
"golang.org/x/tools/go/analysis/passes/testinggoroutine"
@@ -70,6 +71,7 @@ func vet() {
7071
shift.Analyzer,
7172
sigchanyzer.Analyzer,
7273
stdmethods.Analyzer,
74+
stdversion.Analyzer,
7375
stringintconv.Analyzer,
7476
structtag.Analyzer,
7577
testinggoroutine.Analyzer,

gopls/doc/analyzers.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ have false positives, for example if fields or methods are accessed
739739
through a type alias that is guarded by a Go version constraint.
740740

741741

742-
[Full documentation](https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/stdversion)
742+
[Full documentation](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/stdversion)
743743

744744
**Enabled by default.**
745745

gopls/internal/settings/api_json.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gopls/internal/settings/settings.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
"golang.org/x/tools/go/analysis/passes/slog"
4242
"golang.org/x/tools/go/analysis/passes/sortslice"
4343
"golang.org/x/tools/go/analysis/passes/stdmethods"
44+
"golang.org/x/tools/go/analysis/passes/stdversion"
4445
"golang.org/x/tools/go/analysis/passes/stringintconv"
4546
"golang.org/x/tools/go/analysis/passes/structtag"
4647
"golang.org/x/tools/go/analysis/passes/testinggoroutine"
@@ -60,7 +61,6 @@ import (
6061
"golang.org/x/tools/gopls/internal/analysis/simplifycompositelit"
6162
"golang.org/x/tools/gopls/internal/analysis/simplifyrange"
6263
"golang.org/x/tools/gopls/internal/analysis/simplifyslice"
63-
"golang.org/x/tools/gopls/internal/analysis/stdversion"
6464
"golang.org/x/tools/gopls/internal/analysis/stubmethods"
6565
"golang.org/x/tools/gopls/internal/analysis/undeclaredname"
6666
"golang.org/x/tools/gopls/internal/analysis/unusedparams"

gopls/internal/test/marker/testdata/diagnostics/stdversion.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Test of "too new" diagnostics from the stdversion analyzer.
33
This test references go1.21 symbols from std, but the analyzer itself
44
depends on the the go1.22 behavior of versions.FileVersion.
55

6-
See also gopls/internal/analysis/stdversion/testdata/test.txtar,
6+
See also go/analysis/passes/stdversion/testdata/test.txtar,
77
which runs the same test in the analysistest framework.
88

99
-- flags --

0 commit comments

Comments
 (0)