Unreviewed changes
1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: go/analysis/passes/modernize/minmax.go
Insertions: 2, Deletions: 1.
@@ -308,7 +308,8 @@
decl := def.Parent().Node().(*ast.FuncDecl)
// Check if this function matches the built-in min/max signature
// and behavior, and verify that we have go1.21.
- if canUseBuiltinMinMax(fn, decl.Body) && analyzerutil.FileUsesGoVersion(pass, astutil.EnclosingFile(def), versions.Go1_21) {
+ if canUseBuiltinMinMax(fn, decl.Body) &&
+ analyzerutil.FileUsesGoVersion(pass, astutil.EnclosingFile(def), versions.Go1_21) {
// Expand to include leading doc comment
pos := decl.Pos()
if docs := astutil.DocComment(decl); docs != nil {
```
Change information
Commit message:
go/analysis/passes/modernize: require go1.21 to remove user-defined min/max
Adds check for go1.21 before removing user-defined min/max functions that are equivalent to the built-in functions.
Switch to checking FileUsesGoVersion later, just before pass.Report, since it is expensive and the number of files with 1.21 is high.
Fixes golang/go#78250
Change-Id: I57eb546f1218065f869c6dd5a6fabfa9062f3ced
Files:
- M go/analysis/passes/modernize/minmax.go
- M go/analysis/passes/modernize/modernize_test.go
- A go/analysis/passes/modernize/testdata/src/minmax/go120/minmax.go
- A go/analysis/passes/modernize/testdata/src/minmax/go120/minmax_go120.go
- A go/analysis/passes/modernize/testdata/src/minmax/go120/minmax_go120.go.golden
Change size: M
Delta: 5 files changed, 58 insertions(+), 27 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Alan Donovan
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI