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

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

Issue 12936046: code review 12936046: go.tools/cmd/vet: check for recursive stringers (Closed)
Left Patch Set: diff -r 40ea8f657df4 https://code.google.com/p/go.tools Created 10 years, 7 months ago
Right Patch Set: diff -r 7cdd043fad2b https://code.google.com/p/go.tools Created 10 years, 7 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 | « no previous file | cmd/vet/print.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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // The parse tree walkers are all methods of this type. 82 // The parse tree walkers are all methods of this type.
83 type File struct { 83 type File struct {
84 pkg *Package 84 pkg *Package
85 fset *token.FileSet 85 fset *token.FileSet
86 name string 86 name string
87 content []byte 87 content []byte
88 file *ast.File 88 file *ast.File
89 b bytes.Buffer // for use by methods 89 b bytes.Buffer // for use by methods
90 90
91 // The last "String() string" method receiver we saw while walking. 91 // The last "String() string" method receiver we saw while walking.
92 » // This is used by 92 » // This is used by the recursiveStringer method in print.go.
93 lastStringerReceiver *ast.Object 93 lastStringerReceiver *ast.Object
94 } 94 }
95 95
96 func main() { 96 func main() {
97 flag.Usage = Usage 97 flag.Usage = Usage
98 flag.Parse() 98 flag.Parse()
99 99
100 // If a check is named explicitly, turn off the 'all' flag. 100 // If a check is named explicitly, turn off the 'all' flag.
101 for name, ptr := range report { 101 for name, ptr := range report {
102 if name != "all" && *ptr { 102 if name != "all" && *ptr {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 func (f *File) walkRangeStmt(n *ast.RangeStmt) { 481 func (f *File) walkRangeStmt(n *ast.RangeStmt) {
482 checkRangeLoop(f, n) 482 checkRangeLoop(f, n)
483 } 483 }
484 484
485 // gofmt returns a string representation of the expression. 485 // gofmt returns a string representation of the expression.
486 func (f *File) gofmt(x ast.Expr) string { 486 func (f *File) gofmt(x ast.Expr) string {
487 f.b.Reset() 487 f.b.Reset()
488 printer.Fprint(&f.b, f.fset, x) 488 printer.Fprint(&f.b, f.fset, x)
489 return f.b.String() 489 return f.b.String()
490 } 490 }
LEFTRIGHT
« no previous file | cmd/vet/print.go » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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