Skip to content

Commit 283fce2

Browse files
adonovangopherbot
authored andcommitted
x/tools: drop go1.18 support
Updates golang/go#64407 Change-Id: I247a7ff7f07613674f8e31e4cb9c5a68762d2203 Reviewed-on: https://go-review.googlesource.com/c/tools/+/567418 Reviewed-by: Robert Findley <[email protected]> Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 7f348c7 commit 283fce2

File tree

118 files changed

+186
-1584
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+186
-1584
lines changed

cmd/bisect/main_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"testing"
1818

1919
"golang.org/x/tools/internal/bisect"
20-
"golang.org/x/tools/internal/compat"
2120
"golang.org/x/tools/internal/diffp"
2221
"golang.org/x/tools/txtar"
2322
)
@@ -82,7 +81,7 @@ func Test(t *testing.T) {
8281
have[color] = true
8382
}
8483
if m.ShouldReport(uint64(i)) {
85-
out = compat.Appendf(out, "%s %s\n", color, bisect.Marker(uint64(i)))
84+
out = fmt.Appendf(out, "%s %s\n", color, bisect.Marker(uint64(i)))
8685
}
8786
}
8887
err = nil

copyright/copyright.go

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.18
6-
// +build go1.18
7-
85
// Package copyright checks that files have the correct copyright notices.
96
package copyright
107

copyright/copyright_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.18
6-
// +build go1.18
7-
85
package copyright
96

107
import (

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module golang.org/x/tools
22

3-
go 1.18
3+
go 1.19
44

55
require (
66
github.com/yuin/goldmark v1.4.13

go/analysis/passes/asmdecl/arches_go118.go

-12
This file was deleted.

go/analysis/passes/asmdecl/arches_go119.go

-14
This file was deleted.

go/analysis/passes/asmdecl/asmdecl.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ var (
9696
asmArchRISCV64 = asmArch{name: "riscv64", bigEndian: false, stack: "SP", lr: true, retRegs: []string{"X10", "F10"}}
9797
asmArchS390X = asmArch{name: "s390x", bigEndian: true, stack: "R15", lr: true}
9898
asmArchWasm = asmArch{name: "wasm", bigEndian: false, stack: "SP", lr: false}
99+
asmArchLoong64 = asmArch{name: "loong64", bigEndian: false, stack: "R3", lr: true}
99100

100101
arches = []*asmArch{
101102
&asmArch386,
@@ -111,11 +112,11 @@ var (
111112
&asmArchRISCV64,
112113
&asmArchS390X,
113114
&asmArchWasm,
115+
&asmArchLoong64,
114116
}
115117
)
116118

117119
func init() {
118-
arches = append(arches, additionalArches()...)
119120
for _, arch := range arches {
120121
arch.sizes = types.SizesFor("gc", arch.name)
121122
if arch.sizes == nil {

go/analysis/passes/assign/testdata/src/typeparams/typeparams.go

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
// This file contains tests for the useless-assignment checker.
66

7-
//go:build go1.18
8-
97
package testdata
108

119
import "math/rand"

go/analysis/passes/assign/testdata/src/typeparams/typeparams.go.golden

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
// This file contains tests for the useless-assignment checker.
66

7-
//go:build go1.18
8-
97
package testdata
108

119
import "math/rand"

go/analysis/passes/bools/testdata/src/typeparams/typeparams.go

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
// This file contains tests for the bool checker.
66

7-
//go:build go1.18
8-
97
package typeparams
108

119
type T[P interface{ ~int }] struct {

go/analysis/passes/composite/testdata/src/a/a_fuzz_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.18
6-
// +build go1.18
7-
85
package a
96

107
import "testing"

go/analysis/passes/composite/testdata/src/a/a_fuzz_test.go.golden

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.18
6-
// +build go1.18
7-
85
package a
96

107
import "testing"

go/analysis/passes/httpresponse/testdata/src/typeparams/typeparams.go

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
// This file contains tests for the httpresponse checker.
66

7-
//go:build go1.18
8-
97
package typeparams
108

119
import (

go/analysis/passes/loopclosure/loopclosure_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ func TestVersions22(t *testing.T) {
3333
}
3434

3535
func TestVersions18(t *testing.T) {
36-
testenv.NeedsGo1Point(t, 18)
37-
3836
testfile := filepath.Join(analysistest.TestData(), "src", "versions", "go18.txtar")
3937
runTxtarFile(t, testfile, loopclosure.Analyzer, "golang.org/fake/versions")
4038
}

go/analysis/passes/loopclosure/testdata/src/typeparams/typeparams.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// This file contains legacy tests for the loopclosure checker for GoVersion <go1.22.
66
// Expectations are incorrect after go1.22.
77

8-
//go:build go1.18
8+
//go:build go1.19
99

1010
package typeparams
1111

go/analysis/passes/loopclosure/testdata/src/versions/go18.txtar

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Test loopclosure at go version go1.18.
1+
Test loopclosure at go version go1.19.
22

33
-- go.mod --
44
module golang.org/fake/versions
55

6-
go 1.18
6+
go 1.19
77
-- pre.go --
8-
//go:build go1.18
8+
//go:build go1.19
99

1010
package versions
1111

go/analysis/passes/loopclosure/testdata/src/versions/go22.txtar

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
Test loopclosure at go version go1.22.
2+
3+
The go1.19 build tag is necessary to force the file version.
4+
25
-- go.mod --
36
module golang.org/fake/versions
47

go/analysis/passes/lostcancel/testdata/src/typeparams/typeparams.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
// This file contains tests for the lostcancel checker.
66

7-
//go:build go1.18
8-
97
package typeparams
108

119
import (
@@ -20,7 +18,7 @@ func _[T any]() {
2018
if false {
2119
_ = cancel
2220
}
23-
} // want "this return statement may be reached without using the cancel var defined on line 19"
21+
} // want "this return statement may be reached without using the cancel var defined on line 17"
2422

2523
func _[T any]() {
2624
_, cancel := context.WithCancel(bg)

go/analysis/passes/nilfunc/testdata/src/typeparams/typeparams.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
// This file contains tests for the lostcancel checker.
66

7-
//go:build go1.18
8-
97
package typeparams
108

119
func f[P any]() {}
@@ -22,7 +20,7 @@ type T2[P1 any, P2 any] struct {
2220
g func(P1) P2
2321
}
2422

25-
func Comparison[P any](f2 func()T1[P]) {
23+
func Comparison[P any](f2 func() T1[P]) {
2624
var t1 T1[P]
2725
var t2 T2[P, int]
2826
var fn func()
@@ -40,7 +38,7 @@ func Comparison[P any](f2 func()T1[P]) {
4038
}
4139
}
4240

43-
func Index[P any](a [](func()P)) {
41+
func Index[P any](a [](func() P)) {
4442
if a[1] == nil {
4543
// no error
4644
}
@@ -49,4 +47,4 @@ func Index[P any](a [](func()P)) {
4947
if t1[1].f == nil || t2[0][1].g == nil {
5048
// no error
5149
}
52-
}
50+
}

go/analysis/passes/nilness/nilness_go117_test.go

-20
This file was deleted.

go/analysis/passes/nilness/nilness_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ func Test(t *testing.T) {
1616
analysistest.Run(t, testdata, nilness.Analyzer, "a")
1717
}
1818

19+
func TestNilness(t *testing.T) {
20+
testdata := analysistest.TestData()
21+
analysistest.Run(t, testdata, nilness.Analyzer, "b")
22+
}
23+
1924
func TestInstantiated(t *testing.T) {
2025
testdata := analysistest.TestData()
2126
analysistest.Run(t, testdata, nilness.Analyzer, "c")

go/analysis/passes/printf/printf_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@ import (
99

1010
"golang.org/x/tools/go/analysis/analysistest"
1111
"golang.org/x/tools/go/analysis/passes/printf"
12-
"golang.org/x/tools/internal/testenv"
1312
)
1413

1514
func Test(t *testing.T) {
16-
testenv.NeedsGo1Point(t, 19) // tests use fmt.Appendf
17-
1815
testdata := analysistest.TestData()
1916
printf.Analyzer.Flags.Set("funcs", "Warn,Warnf")
2017

go/analysis/passes/printf/testdata/src/typeparams/diagnostics.go

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.18
6-
// +build go1.18
7-
85
package typeparams
96

107
import "fmt"

go/analysis/passes/printf/testdata/src/typeparams/wrappers.go

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.18
6-
// +build go1.18
7-
85
package typeparams
96

107
import "fmt"

go/analysis/passes/stdmethods/testdata/src/a/b.go

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.18
6-
// +build go1.18
7-
85
package a
96

107
type H int

go/analysis/passes/testinggoroutine/util.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func localFunctionDecls(info *types.Info, files []*ast.File) func(*types.Func) *
3030
}
3131
}
3232
}
33-
// TODO: once we only support go1.19+, set f = f.Origin() here.
33+
// TODO: set f = f.Origin() here.
3434
return fnDecls[f]
3535
}
3636
}

go/analysis/passes/tests/testdata/src/a/go118_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//go:build go1.18
2-
// +build go1.18
3-
41
package a
52

63
import (

go/analysis/passes/unusedresult/testdata/src/typeparams/typeparams.go

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright 2015 The Go Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
4-
//
5-
//go:build go1.18
64

75
package typeparams
86

go/analysis/passes/unusedresult/testdata/src/typeparams/userdefs/userdefs.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright 2015 The Go Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
4-
//
5-
//go:build go1.18
64

75
package userdefs
86

@@ -25,4 +23,4 @@ type MultiTypeParam[T any, U any] struct {
2523

2624
func (_ *MultiTypeParam[T, U]) String() string {
2725
return "MultiTypeParam"
28-
}
26+
}

go/analysis/unitchecker/separate_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.19
6-
75
package unitchecker_test
86

97
// This file illustrates separate analysis with an example.

go/analysis/unitchecker/unitchecker_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.19
6-
75
package unitchecker_test
86

97
import (

go/callgraph/rta/rta.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import (
4646
"golang.org/x/tools/go/ssa"
4747
"golang.org/x/tools/go/types/typeutil"
4848
"golang.org/x/tools/internal/aliases"
49-
"golang.org/x/tools/internal/compat"
5049
)
5150

5251
// A Result holds the results of Rapid Type Analysis, which includes the
@@ -546,7 +545,7 @@ func fingerprint(mset *types.MethodSet) uint64 {
546545
for i := 0; i < mset.Len(); i++ {
547546
method := mset.At(i).Obj()
548547
sig := method.Type().(*types.Signature)
549-
sum := crc32.ChecksumIEEE(compat.Appendf(space[:], "%s/%d/%d",
548+
sum := crc32.ChecksumIEEE(fmt.Appendf(space[:], "%s/%d/%d",
550549
method.Id(),
551550
sig.Params().Len(),
552551
sig.Results().Len()))

0 commit comments

Comments
 (0)