Skip to content

Commit

Permalink
x/tools: drop go1.18 support
Browse files Browse the repository at this point in the history
Updates golang/go#64407

Change-Id: I247a7ff7f07613674f8e31e4cb9c5a68762d2203
Reviewed-on: https://go-review.googlesource.com/c/tools/+/567418
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
adonovan authored and gopherbot committed Feb 29, 2024
1 parent 7f348c7 commit 283fce2
Show file tree
Hide file tree
Showing 118 changed files with 186 additions and 1,584 deletions.
3 changes: 1 addition & 2 deletions cmd/bisect/main_test.go
Expand Up @@ -17,7 +17,6 @@ import (
"testing"

"golang.org/x/tools/internal/bisect"
"golang.org/x/tools/internal/compat"
"golang.org/x/tools/internal/diffp"
"golang.org/x/tools/txtar"
)
Expand Down Expand Up @@ -82,7 +81,7 @@ func Test(t *testing.T) {
have[color] = true
}
if m.ShouldReport(uint64(i)) {
out = compat.Appendf(out, "%s %s\n", color, bisect.Marker(uint64(i)))
out = fmt.Appendf(out, "%s %s\n", color, bisect.Marker(uint64(i)))
}
}
err = nil
Expand Down
3 changes: 0 additions & 3 deletions copyright/copyright.go
Expand Up @@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.18
// +build go1.18

// Package copyright checks that files have the correct copyright notices.
package copyright

Expand Down
3 changes: 0 additions & 3 deletions copyright/copyright_test.go
Expand Up @@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.18
// +build go1.18

package copyright

import (
Expand Down
2 changes: 1 addition & 1 deletion go.mod
@@ -1,6 +1,6 @@
module golang.org/x/tools

go 1.18
go 1.19

require (
github.com/yuin/goldmark v1.4.13
Expand Down
12 changes: 0 additions & 12 deletions go/analysis/passes/asmdecl/arches_go118.go

This file was deleted.

14 changes: 0 additions & 14 deletions go/analysis/passes/asmdecl/arches_go119.go

This file was deleted.

3 changes: 2 additions & 1 deletion go/analysis/passes/asmdecl/asmdecl.go
Expand Up @@ -96,6 +96,7 @@ var (
asmArchRISCV64 = asmArch{name: "riscv64", bigEndian: false, stack: "SP", lr: true, retRegs: []string{"X10", "F10"}}
asmArchS390X = asmArch{name: "s390x", bigEndian: true, stack: "R15", lr: true}
asmArchWasm = asmArch{name: "wasm", bigEndian: false, stack: "SP", lr: false}
asmArchLoong64 = asmArch{name: "loong64", bigEndian: false, stack: "R3", lr: true}

arches = []*asmArch{
&asmArch386,
Expand All @@ -111,11 +112,11 @@ var (
&asmArchRISCV64,
&asmArchS390X,
&asmArchWasm,
&asmArchLoong64,
}
)

func init() {
arches = append(arches, additionalArches()...)
for _, arch := range arches {
arch.sizes = types.SizesFor("gc", arch.name)
if arch.sizes == nil {
Expand Down
Expand Up @@ -4,8 +4,6 @@

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

//go:build go1.18

package testdata

import "math/rand"
Expand Down
Expand Up @@ -4,8 +4,6 @@

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

//go:build go1.18

package testdata

import "math/rand"
Expand Down
Expand Up @@ -4,8 +4,6 @@

// This file contains tests for the bool checker.

//go:build go1.18

package typeparams

type T[P interface{ ~int }] struct {
Expand Down
3 changes: 0 additions & 3 deletions go/analysis/passes/composite/testdata/src/a/a_fuzz_test.go
Expand Up @@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.18
// +build go1.18

package a

import "testing"
Expand Down
Expand Up @@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.18
// +build go1.18

package a

import "testing"
Expand Down
Expand Up @@ -4,8 +4,6 @@

// This file contains tests for the httpresponse checker.

//go:build go1.18

package typeparams

import (
Expand Down
2 changes: 0 additions & 2 deletions go/analysis/passes/loopclosure/loopclosure_test.go
Expand Up @@ -33,8 +33,6 @@ func TestVersions22(t *testing.T) {
}

func TestVersions18(t *testing.T) {
testenv.NeedsGo1Point(t, 18)

testfile := filepath.Join(analysistest.TestData(), "src", "versions", "go18.txtar")
runTxtarFile(t, testfile, loopclosure.Analyzer, "golang.org/fake/versions")
}
Expand Down
Expand Up @@ -5,7 +5,7 @@
// This file contains legacy tests for the loopclosure checker for GoVersion <go1.22.
// Expectations are incorrect after go1.22.

//go:build go1.18
//go:build go1.19

package typeparams

Expand Down
@@ -1,11 +1,11 @@
Test loopclosure at go version go1.18.
Test loopclosure at go version go1.19.

-- go.mod --
module golang.org/fake/versions

go 1.18
go 1.19
-- pre.go --
//go:build go1.18
//go:build go1.19

package versions

Expand Down
@@ -1,4 +1,7 @@
Test loopclosure at go version go1.22.

The go1.19 build tag is necessary to force the file version.

-- go.mod --
module golang.org/fake/versions

Expand Down
Expand Up @@ -4,8 +4,6 @@

// This file contains tests for the lostcancel checker.

//go:build go1.18

package typeparams

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

func _[T any]() {
_, cancel := context.WithCancel(bg)
Expand Down
Expand Up @@ -4,8 +4,6 @@

// This file contains tests for the lostcancel checker.

//go:build go1.18

package typeparams

func f[P any]() {}
Expand All @@ -22,7 +20,7 @@ type T2[P1 any, P2 any] struct {
g func(P1) P2
}

func Comparison[P any](f2 func()T1[P]) {
func Comparison[P any](f2 func() T1[P]) {
var t1 T1[P]
var t2 T2[P, int]
var fn func()
Expand All @@ -40,7 +38,7 @@ func Comparison[P any](f2 func()T1[P]) {
}
}

func Index[P any](a [](func()P)) {
func Index[P any](a [](func() P)) {
if a[1] == nil {
// no error
}
Expand All @@ -49,4 +47,4 @@ func Index[P any](a [](func()P)) {
if t1[1].f == nil || t2[0][1].g == nil {
// no error
}
}
}
20 changes: 0 additions & 20 deletions go/analysis/passes/nilness/nilness_go117_test.go

This file was deleted.

5 changes: 5 additions & 0 deletions go/analysis/passes/nilness/nilness_test.go
Expand Up @@ -16,6 +16,11 @@ func Test(t *testing.T) {
analysistest.Run(t, testdata, nilness.Analyzer, "a")
}

func TestNilness(t *testing.T) {
testdata := analysistest.TestData()
analysistest.Run(t, testdata, nilness.Analyzer, "b")
}

func TestInstantiated(t *testing.T) {
testdata := analysistest.TestData()
analysistest.Run(t, testdata, nilness.Analyzer, "c")
Expand Down
3 changes: 0 additions & 3 deletions go/analysis/passes/printf/printf_test.go
Expand Up @@ -9,12 +9,9 @@ import (

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/go/analysis/passes/printf"
"golang.org/x/tools/internal/testenv"
)

func Test(t *testing.T) {
testenv.NeedsGo1Point(t, 19) // tests use fmt.Appendf

testdata := analysistest.TestData()
printf.Analyzer.Flags.Set("funcs", "Warn,Warnf")

Expand Down
Expand Up @@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.18
// +build go1.18

package typeparams

import "fmt"
Expand Down
3 changes: 0 additions & 3 deletions go/analysis/passes/printf/testdata/src/typeparams/wrappers.go
Expand Up @@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.18
// +build go1.18

package typeparams

import "fmt"
Expand Down
3 changes: 0 additions & 3 deletions go/analysis/passes/stdmethods/testdata/src/a/b.go
Expand Up @@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.18
// +build go1.18

package a

type H int
Expand Down
2 changes: 1 addition & 1 deletion go/analysis/passes/testinggoroutine/util.go
Expand Up @@ -30,7 +30,7 @@ func localFunctionDecls(info *types.Info, files []*ast.File) func(*types.Func) *
}
}
}
// TODO: once we only support go1.19+, set f = f.Origin() here.
// TODO: set f = f.Origin() here.
return fnDecls[f]
}
}
Expand Down
3 changes: 0 additions & 3 deletions go/analysis/passes/tests/testdata/src/a/go118_test.go
@@ -1,6 +1,3 @@
//go:build go1.18
// +build go1.18

package a

import (
Expand Down
@@ -1,8 +1,6 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
//go:build go1.18

package typeparams

Expand Down
@@ -1,8 +1,6 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
//go:build go1.18

package userdefs

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

func (_ *MultiTypeParam[T, U]) String() string {
return "MultiTypeParam"
}
}
2 changes: 0 additions & 2 deletions go/analysis/unitchecker/separate_test.go
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.19

package unitchecker_test

// This file illustrates separate analysis with an example.
Expand Down
2 changes: 0 additions & 2 deletions go/analysis/unitchecker/unitchecker_test.go
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.19

package unitchecker_test

import (
Expand Down
3 changes: 1 addition & 2 deletions go/callgraph/rta/rta.go
Expand Up @@ -46,7 +46,6 @@ import (
"golang.org/x/tools/go/ssa"
"golang.org/x/tools/go/types/typeutil"
"golang.org/x/tools/internal/aliases"
"golang.org/x/tools/internal/compat"
)

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

0 comments on commit 283fce2

Please sign in to comment.