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

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

Issue 7531045: code review 7531045: cmd/vet: add assembly checker (Closed)
Left Patch Set: diff -r aaead10e12ae https://code.google.com/p/go/ Created 12 years ago
Right Patch Set: diff -r 8ab9556841e4 https://code.google.com/p/go/ Created 12 years 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/buildtag.go ('k') | src/cmd/vet/test_asm.go » ('j') | 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"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 return err 234 return err
235 } 235 }
236 // One package per directory. Ignore the files themselves. 236 // One package per directory. Ignore the files themselves.
237 if !f.IsDir() { 237 if !f.IsDir() {
238 return nil 238 return nil
239 } 239 }
240 doPackageDir(path) 240 doPackageDir(path)
241 return nil 241 return nil
242 } 242 }
243 243
244 func (pkg *Package) hasFileWithSuffix(suffix string) bool {
245 for _, f := range pkg.files {
246 if strings.HasSuffix(f.name, suffix) {
247 return true
248 }
249 }
250 return false
251 }
252
244 // walkDir recursively walks the tree looking for Go packages. 253 // walkDir recursively walks the tree looking for Go packages.
245 func walkDir(root string) { 254 func walkDir(root string) {
246 filepath.Walk(root, visit) 255 filepath.Walk(root, visit)
247 } 256 }
248 257
249 // errorf formats the error to standard error, adding program 258 // errorf formats the error to standard error, adding program
250 // identification and a newline, and exits. 259 // identification and a newline, and exits.
251 func errorf(format string, args ...interface{}) { 260 func errorf(format string, args ...interface{}) {
252 fmt.Fprintf(os.Stderr, "vet: "+format+"\n", args...) 261 fmt.Fprintf(os.Stderr, "vet: "+format+"\n", args...)
253 os.Exit(2) 262 os.Exit(2)
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 func (f *File) walkRangeStmt(n *ast.RangeStmt) { 406 func (f *File) walkRangeStmt(n *ast.RangeStmt) {
398 checkRangeLoop(f, n) 407 checkRangeLoop(f, n)
399 } 408 }
400 409
401 // gofmt returns a string representation of the expression. 410 // gofmt returns a string representation of the expression.
402 func (f *File) gofmt(x ast.Expr) string { 411 func (f *File) gofmt(x ast.Expr) string {
403 f.b.Reset() 412 f.b.Reset()
404 printer.Fprint(&f.b, f.fset, x) 413 printer.Fprint(&f.b, f.fset, x)
405 return f.b.String() 414 return f.b.String()
406 } 415 }
LEFTRIGHT

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