Skip to content

Commit 9da4c1d

Browse files
build(deps): bump golang.org/x/tools from 0.38.0 to 0.39.0 (#6193)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
1 parent c7c1cb6 commit 9da4c1d

File tree

13 files changed

+30
-38
lines changed

13 files changed

+30
-38
lines changed

.golangci.next.reference.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,6 +2137,8 @@ linters:
21372137
- newexpr
21382138
# Suggest replacing omitempty with omitzero for struct fields.
21392139
- omitzero
2140+
# Remove obsolete //+build comments.
2141+
- plusbuild
21402142
# Replace 3-clause for loops with for-range over integers.
21412143
- rangeint
21422144
# Replace reflect.TypeOf(x) with TypeFor[T]().
@@ -2147,6 +2149,8 @@ linters:
21472149
- slicessort
21482150
# Use iterators instead of Len/At-style APIs.
21492151
- stditerators
2152+
# Replace strings.Index etc. with strings.Cut.
2153+
- stringscut
21502154
# Replace HasPrefix/TrimPrefix with CutPrefix.
21512155
- stringscutprefix
21522156
# Replace ranging over Split/Fields with SplitSeq/FieldsSeq.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ require (
139139
golang.org/x/mod v0.30.0
140140
golang.org/x/sync v0.18.0
141141
golang.org/x/sys v0.38.0
142-
golang.org/x/tools v0.38.0
142+
golang.org/x/tools v0.39.0
143143
gopkg.in/yaml.v3 v3.0.1
144144
honnef.co/go/tools v0.6.1
145145
mvdan.cc/gofumpt v0.9.2

go.sum

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,11 +717,13 @@
717717
"minmax",
718718
"newexpr",
719719
"omitzero",
720+
"plusbuild",
720721
"rangeint",
721722
"reflecttypefor",
722723
"slicescontains",
723724
"slicessort",
724725
"stditerators",
726+
"stringscut",
725727
"stringscutprefix",
726728
"stringsseq",
727729
"stringsbuilder",

pkg/golinters/contextcheck/contextcheck.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ package contextcheck
22

33
import (
44
"github.com/kkHAIKE/contextcheck"
5+
"golang.org/x/tools/go/analysis/passes/ctrlflow"
6+
"golang.org/x/tools/go/analysis/passes/inspect"
57

68
"github.com/golangci/golangci-lint/v2/pkg/goanalysis"
79
"github.com/golangci/golangci-lint/v2/pkg/lint/linter"
810
)
911

1012
func New() *goanalysis.Linter {
1113
analyzer := contextcheck.NewAnalyzer(contextcheck.Configuration{})
14+
// TODO(ldez) there is a problem with this linter:
15+
// I think the problem related to facts.
16+
// The BuildSSA pass has been changed inside (0.39.0):
17+
// https://github.com/golang/tools/commit/b74c09864920a69a4d2f6ef0ecb4f9cff226893a
18+
analyzer.Requires = append(analyzer.Requires, ctrlflow.Analyzer, inspect.Analyzer)
1219

1320
return goanalysis.
1421
NewLinterFromAnalyzer(analyzer).

pkg/golinters/modernize/testdata/fix/in/reflecttypefor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var (
1717
_ = reflect.TypeOf((*error)(nil)) // want "reflect.TypeOf call can be simplified using TypeFor"
1818
_ = reflect.TypeOf(io.Reader(nil)) // nope (likely a mistake)
1919
_ = reflect.TypeOf((*io.Reader)(nil)) // want "reflect.TypeOf call can be simplified using TypeFor"
20-
_ = reflect.TypeOf(*new(time.Time)) // nope (false negative of noEffects)
20+
_ = reflect.TypeOf(*new(time.Time)) // want "reflect.TypeOf call can be simplified using TypeFor"
2121
_ = reflect.TypeOf(time.Time{}) // want "reflect.TypeOf call can be simplified using TypeFor"
2222
_ = reflect.TypeOf(time.Duration(0)) // want "reflect.TypeOf call can be simplified using TypeFor"
2323
)

pkg/golinters/modernize/testdata/fix/in/slicescontains.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func assignTrueBreak(slice []int, needle int) {
5252
print(found)
5353
}
5454

55-
func assignFalseBreak(slice []int, needle int) { // TODO: treat this specially like booleanTrue
55+
func assignFalseBreak(slice []int, needle int) {
5656
found := true
5757
for _, elem := range slice { // want "Loop can be simplified using slices.Contains"
5858
if elem == needle {

pkg/golinters/modernize/testdata/fix/out/forvar.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,28 @@ package forvar
55
func _(m map[int]int, s []int) {
66
// changed
77
for i := range s {
8-
// want "copying variable is unneeded"
98
go f(i)
109
}
1110
for _, v := range s {
12-
// want "copying variable is unneeded"
1311
go f(v)
1412
}
1513
for k, v := range m {
16-
// want "copying variable is unneeded"
17-
// want "copying variable is unneeded"
1814
go f(k)
1915
go f(v)
2016
}
2117
for k, v := range m {
22-
// want "copying variable is unneeded"
23-
// want "copying variable is unneeded"
2418
go f(k)
2519
go f(v)
2620
}
2721
for k, v := range m {
28-
// want "copying variable is unneeded"
2922
go f(k)
3023
go f(v)
3124
}
3225
for k, v := range m {
33-
// want "copying variable is unneeded"
3426
go f(k)
3527
go f(v)
3628
}
3729
for i := range s {
38-
/* hi */ // want "copying variable is unneeded"
3930
go f(i)
4031
}
4132
// nope

pkg/golinters/modernize/testdata/fix/out/reflecttypefor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var (
1717
_ = reflect.TypeFor[*error]() // want "reflect.TypeOf call can be simplified using TypeFor"
1818
_ = reflect.TypeOf(io.Reader(nil)) // nope (likely a mistake)
1919
_ = reflect.TypeFor[*io.Reader]() // want "reflect.TypeOf call can be simplified using TypeFor"
20-
_ = reflect.TypeOf(*new(time.Time)) // nope (false negative of noEffects)
20+
_ = reflect.TypeFor[time.Time]() // want "reflect.TypeOf call can be simplified using TypeFor"
2121
_ = reflect.TypeFor[time.Time]() // want "reflect.TypeOf call can be simplified using TypeFor"
2222
_ = reflect.TypeFor[time.Duration]() // want "reflect.TypeOf call can be simplified using TypeFor"
2323
)

pkg/golinters/modernize/testdata/fix/out/slicescontains.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,8 @@ func assignTrueBreak(slice []int, needle int) {
3838
print(found)
3939
}
4040

41-
func assignFalseBreak(slice []int, needle int) { // TODO: treat this specially like booleanTrue
42-
found := true
43-
if slices.Contains(slice, needle) {
44-
found = false
45-
}
41+
func assignFalseBreak(slice []int, needle int) {
42+
found := !slices.Contains(slice, needle)
4643
print(found)
4744
}
4845

0 commit comments

Comments
 (0)