Skip to content

Commit 2e4e80c

Browse files
committed
rebase
1 parent cab5b93 commit 2e4e80c

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

go/analysis/passes/printf/printf.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,6 @@ func checkPrintf(pass *analysis.Pass, kind Kind, call *ast.CallExpr, name string
532532
if err != nil {
533533
// All error messages are in predicate form ("call has a problem")
534534
// so that they may be affixed into a subject ("log.Printf ").
535-
// See https://go-review.googlesource.com/c/tools/+/632598/comment/9d980373_e6460abf/
536535
pass.ReportRangef(call.Args[idx], "%s %s", name, err)
537536
return
538537
}
@@ -697,7 +696,7 @@ func okPrintfArg(pass *analysis.Pass, call *ast.CallExpr, maxArgIndex *int, firs
697696
if reason != "" {
698697
details = " (" + reason + ")"
699698
}
700-
pass.ReportRangef(call, "%s format %s uses non-int %s%s as argument of *", name, operation.Text, analysisutil.Format(pass.Fset, arg), details)
699+
pass.ReportRangef(call, "%s format %s uses non-int %s%s as argument of *", name, operation.Text, analysisinternal.Format(pass.Fset, arg), details)
701700
return false
702701
}
703702
}
@@ -724,7 +723,7 @@ func okPrintfArg(pass *analysis.Pass, call *ast.CallExpr, maxArgIndex *int, firs
724723
}
725724
arg := call.Args[verbArgIndex]
726725
if isFunctionValue(pass, arg) && verb != 'p' && verb != 'T' {
727-
pass.ReportRangef(call, "%s format %s arg %s is a func value, not called", name, operation.Text, analysisutil.Format(pass.Fset, arg))
726+
pass.ReportRangef(call, "%s format %s arg %s is a func value, not called", name, operation.Text, analysisinternal.Format(pass.Fset, arg))
728727
return false
729728
}
730729
if reason, ok := matchArgType(pass, v.typ, arg); !ok {
@@ -736,12 +735,12 @@ func okPrintfArg(pass *analysis.Pass, call *ast.CallExpr, maxArgIndex *int, firs
736735
if reason != "" {
737736
details = " (" + reason + ")"
738737
}
739-
pass.ReportRangef(call, "%s format %s has arg %s of wrong type %s%s", name, operation.Text, analysisutil.Format(pass.Fset, arg), typeString, details)
738+
pass.ReportRangef(call, "%s format %s has arg %s of wrong type %s%s", name, operation.Text, analysisinternal.Format(pass.Fset, arg), typeString, details)
740739
return false
741740
}
742741
if v.typ&argString != 0 && v.verb != 'T' && !strings.Contains(operation.Flags, "#") {
743742
if methodName, ok := recursiveStringer(pass, arg); ok {
744-
pass.ReportRangef(call, "%s format %s with arg %s causes recursive %s method call", name, operation.Text, analysisutil.Format(pass.Fset, arg), methodName)
743+
pass.ReportRangef(call, "%s format %s with arg %s causes recursive %s method call", name, operation.Text, analysisinternal.Format(pass.Fset, arg), methodName)
745744
return false
746745
}
747746
}
@@ -893,7 +892,7 @@ func checkPrint(pass *analysis.Pass, call *ast.CallExpr, name string) {
893892
if sel, ok := call.Args[0].(*ast.SelectorExpr); ok {
894893
if x, ok := sel.X.(*ast.Ident); ok {
895894
if x.Name == "os" && strings.HasPrefix(sel.Sel.Name, "Std") {
896-
pass.ReportRangef(call, "%s does not take io.Writer but has first arg %s", name, analysisutil.Format(pass.Fset, call.Args[0]))
895+
pass.ReportRangef(call, "%s does not take io.Writer but has first arg %s", name, analysisinternal.Format(pass.Fset, call.Args[0]))
897896
}
898897
}
899898
}
@@ -922,10 +921,10 @@ func checkPrint(pass *analysis.Pass, call *ast.CallExpr, name string) {
922921
}
923922
for _, arg := range args {
924923
if isFunctionValue(pass, arg) {
925-
pass.ReportRangef(call, "%s arg %s is a func value, not called", name, analysisutil.Format(pass.Fset, arg))
924+
pass.ReportRangef(call, "%s arg %s is a func value, not called", name, analysisinternal.Format(pass.Fset, arg))
926925
}
927926
if methodName, ok := recursiveStringer(pass, arg); ok {
928-
pass.ReportRangef(call, "%s arg %s causes recursive call to %s method", name, analysisutil.Format(pass.Fset, arg), methodName)
927+
pass.ReportRangef(call, "%s arg %s causes recursive call to %s method", name, analysisinternal.Format(pass.Fset, arg), methodName)
929928
}
930929
}
931930
}

internal/fmtstr/parse.go

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
// Package fmtstr defines a parser for format strings as used by [fmt.Printf].
6-
76
package fmtstr
87

98
import (
@@ -56,7 +55,6 @@ type Range struct {
5655
//
5756
// All error messages are in predicate form ("call has a problem")
5857
// so that they may be affixed into a subject ("log.Printf ").
59-
// See https://go-review.googlesource.com/c/tools/+/632598/comment/9d980373_e6460abf/
6058
//
6159
// The flags will only be a subset of ['#', '0', '+', '-', ' '].
6260
// It does not perform any validation of verbs, nor the

0 commit comments

Comments
 (0)