[tools] go/analysis/passes/modernize: respect bootstrap toolchain version

0 views
Skip to first unread message

Alan Donovan (Gerrit)

unread,
Nov 10, 2025, 2:52:45 PM (2 days ago) Nov 10
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Robert Findley, golang-co...@googlegroups.com

Alan Donovan submitted the change

Change information

Commit message:
go/analysis/passes/modernize: respect bootstrap toolchain version

fileUsesGoVersion (formerly fileUses) now checks not only the FileVersion
but the bootstrap toolchain version too, so that, for example,
we don't prematurely modernize packages in the compiler to use
features of go1.26.

Unfortunately this change cannot be tested via the analysistest
framework because it would require that we overwrite the sources
of actual std packages.

lostcancel and maprange now both use copies of fileUsesGoVersion too.
I will merge them into analyzerutil once CL 718081 is merged.

For golang/go#71859
Change-Id: I4b8ede616a46c03bc58f017aa7fc522d1df535f7
Reviewed-by: Robert Findley <rfin...@google.com>
Files:
  • M go/analysis/passes/loopclosure/loopclosure.go
  • M go/analysis/passes/modernize/any.go
  • M go/analysis/passes/modernize/bloop.go
  • M go/analysis/passes/modernize/errorsastype.go
  • M go/analysis/passes/modernize/fmtappendf.go
  • M go/analysis/passes/modernize/forvar.go
  • M go/analysis/passes/modernize/maps.go
  • M go/analysis/passes/modernize/minmax.go
  • M go/analysis/passes/modernize/modernize.go
  • M go/analysis/passes/modernize/newexpr.go
  • M go/analysis/passes/modernize/omitzero.go
  • M go/analysis/passes/modernize/plusbuild.go
  • M go/analysis/passes/modernize/rangeint.go
  • M go/analysis/passes/modernize/reflect.go
  • M go/analysis/passes/modernize/slices.go
  • M go/analysis/passes/modernize/slicescontains.go
  • M go/analysis/passes/modernize/slicesdelete.go
  • M go/analysis/passes/modernize/sortslice.go
  • M go/analysis/passes/modernize/stditerators.go
  • M go/analysis/passes/modernize/stringscut.go
  • M go/analysis/passes/modernize/stringscutprefix.go
  • M go/analysis/passes/modernize/stringsseq.go
  • M go/analysis/passes/modernize/testingcontext.go
  • M go/analysis/passes/modernize/waitgroup.go
  • M gopls/internal/analysis/maprange/maprange.go
  • M gopls/internal/cache/check.go
  • M internal/versions/features.go
Change size: M
Delta: 27 files changed, 149 insertions(+), 83 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Robert Findley
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I4b8ede616a46c03bc58f017aa7fc522d1df535f7
Gerrit-Change-Number: 718503
Gerrit-PatchSet: 6
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Robert Findley <rfin...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages