mirror of
https://github.com/golang/go
synced 2024-11-22 09:54:40 -07:00
CL 4291070: incorporating rsc's feedback
R=rsc CC=golang-dev https://golang.org/cl/4313054
This commit is contained in:
parent
a7bb288f99
commit
536531769b
@ -256,7 +256,7 @@ func (f *File) checkPrintf(call *ast.CallExpr, name string, skip int) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if lit.Kind == token.STRING {
|
if lit.Kind == token.STRING {
|
||||||
if strings.Index(lit.Value, "%") < 0 {
|
if strings.Contains(lit.Value, "%") {
|
||||||
if len(call.Args) > skip+1 {
|
if len(call.Args) > skip+1 {
|
||||||
f.Badf(call.Pos(), "no formatting directive in %s call", name)
|
f.Badf(call.Pos(), "no formatting directive in %s call", name)
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ func (f *File) checkPrint(call *ast.CallExpr, name string, skip int) {
|
|||||||
}
|
}
|
||||||
arg := args[skip]
|
arg := args[skip]
|
||||||
if lit, ok := arg.(*ast.BasicLit); ok && lit.Kind == token.STRING {
|
if lit, ok := arg.(*ast.BasicLit); ok && lit.Kind == token.STRING {
|
||||||
if strings.Index(lit.Value, "%") >= 0 {
|
if strings.Contains(lit.Value, "%") {
|
||||||
f.Badf(call.Pos(), "possible formatting directive in %s call", name)
|
f.Badf(call.Pos(), "possible formatting directive in %s call", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ func walkBinary(e *ast.BinaryExpr) (has4, has5 bool, maxProblem int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case *ast.StarExpr:
|
case *ast.StarExpr:
|
||||||
if e.Op == token.QUO {
|
if e.Op == token.QUO { // `*/`
|
||||||
maxProblem = 5
|
maxProblem = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ func (p *printer) internalError(msg ...interface{}) {
|
|||||||
|
|
||||||
|
|
||||||
// escape escapes string s by bracketing it with tabwriter.Escape.
|
// escape escapes string s by bracketing it with tabwriter.Escape.
|
||||||
// Escapes strings pass through tabwriter unchanged. (Note that
|
// Escaped strings pass through tabwriter unchanged. (Note that
|
||||||
// valid Go programs cannot contain tabwriter.Escape bytes since
|
// valid Go programs cannot contain tabwriter.Escape bytes since
|
||||||
// they do not appear in legal UTF-8 sequences).
|
// they do not appear in legal UTF-8 sequences).
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user