]> Cypherpunks repositories - gostls13.git/commitdiff
CL 4291070: incorporating rsc's feedback
authorRobert Griesemer <gri@golang.org>
Tue, 29 Mar 2011 16:08:23 +0000 (09:08 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 29 Mar 2011 16:08:23 +0000 (09:08 -0700)
R=rsc
CC=golang-dev
https://golang.org/cl/4313054

src/cmd/govet/govet.go
src/pkg/go/printer/nodes.go
src/pkg/go/printer/printer.go

index b9e769af1c94f3f27e86e570b3af154ea1ec9bc7..c9b0a9db37eb08116719bd7545e85e4baca9c379 100644 (file)
@@ -256,7 +256,7 @@ func (f *File) checkPrintf(call *ast.CallExpr, name string, skip int) {
                return
        }
        if lit.Kind == token.STRING {
-               if strings.Index(lit.Value, "%") < 0 {
+               if strings.Contains(lit.Value, "%") {
                        if len(call.Args) > skip+1 {
                                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]
        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)
                }
        }
index 2f12038e522d59ea18db8e6a36ace753b855282a..0b3b6621e6c1513506163e31499b46d570176bc2 100644 (file)
@@ -515,7 +515,7 @@ func walkBinary(e *ast.BinaryExpr) (has4, has5 bool, maxProblem int) {
                }
 
        case *ast.StarExpr:
-               if e.Op == token.QUO {
+               if e.Op == token.QUO { // `*/`
                        maxProblem = 5
                }
 
index b0a31a640426e6cb6c9bcce68a00a214c844e00e..2fbec862917eab7bf3f6da7429d4e0c04679d916 100644 (file)
@@ -127,7 +127,7 @@ func (p *printer) internalError(msg ...interface{}) {
 
 
 // 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
 // they do not appear in legal UTF-8 sequences).
 //