Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(447)

Delta Between Two Patch Sets: src/cmd/vet/main.go

Issue 7097048: code review 7097048: cmd/vet: detect misuse of atomic.Add* (Closed)
Left Patch Set: diff -r c53ac9baac67 https://code.google.com/p/go/ Created 11 years, 2 months ago
Right Patch Set: diff -r 7dc8d66efb6d https://code.google.com/p/go/ Created 11 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/vet/atomic.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Vet is a simple checker for static errors in Go source code. 5 // Vet is a simple checker for static errors in Go source code.
6 // See doc.go for more information. 6 // See doc.go for more information.
7 package main 7 package main
8 8
9 import ( 9 import (
10 "bytes" 10 "bytes"
11 "flag" 11 "flag"
12 "fmt" 12 "fmt"
13 "go/ast" 13 "go/ast"
14 "go/parser" 14 "go/parser"
15 "go/printer"
15 "go/token" 16 "go/token"
16 "io" 17 "io"
17 "os" 18 "os"
18 "path/filepath" 19 "path/filepath"
19 "strconv" 20 "strconv"
20 "strings" 21 "strings"
21 ) 22 )
22 23
23 var verbose = flag.Bool("v", false, "verbose") 24 var verbose = flag.Bool("v", false, "verbose")
24 var exitCode = 0 25 var exitCode = 0
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 for _, id := range field.Names { 261 for _, id := range field.Names {
261 f.walkMethod(id, field.Type.(*ast.FuncType)) 262 f.walkMethod(id, field.Type.(*ast.FuncType))
262 } 263 }
263 } 264 }
264 } 265 }
265 266
266 // walkRangeStmt walks a range statement. 267 // walkRangeStmt walks a range statement.
267 func (f *File) walkRangeStmt(n *ast.RangeStmt) { 268 func (f *File) walkRangeStmt(n *ast.RangeStmt) {
268 checkRangeLoop(f, n) 269 checkRangeLoop(f, n)
269 } 270 }
271
272 // goFmt returns a string representation of the expression
273 func (f *File) gofmt(x ast.Expr) string {
274 f.b.Reset()
275 printer.Fprint(&f.b, f.fset, x)
276 return f.b.String()
277 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b