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

Side by Side Diff: src/cmd/vet/method.go

Issue 7393052: code review 7393052: cmd/vet: restructure to be package-driven (Closed)
Patch Set: diff -r 91778e3920ae https://code.google.com/p/go Created 11 years, 1 month 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:
View unified diff | Download patch
« no previous file with comments | « src/cmd/vet/main.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file contains the code to check canonical methods. 5 // This file contains the code to check canonical methods.
6 6
7 package main 7 package main
8 8
9 import ( 9 import (
10 "fmt" 10 "fmt"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 expectFmt += " " + argjoin(expect.results) 83 expectFmt += " " + argjoin(expect.results)
84 } else if len(expect.results) > 1 { 84 } else if len(expect.results) > 1 {
85 expectFmt += " (" + argjoin(expect.results) + ")" 85 expectFmt += " (" + argjoin(expect.results) + ")"
86 } 86 }
87 87
88 f.b.Reset() 88 f.b.Reset()
89 if err := printer.Fprint(&f.b, f.fset, t); err != nil { 89 if err := printer.Fprint(&f.b, f.fset, t); err != nil {
90 fmt.Fprintf(&f.b, "<%s>", err) 90 fmt.Fprintf(&f.b, "<%s>", err)
91 } 91 }
92 actual := f.b.String() 92 actual := f.b.String()
93 » » actual = strings.TrimPrefix(actual, "func(") 93 » » actual = strings.TrimPrefix(actual, "func")
94 actual = id.Name + actual 94 actual = id.Name + actual
95 95
96 f.Warnf(id.Pos(), "method %s should have signature %s", actual, expectFmt) 96 f.Warnf(id.Pos(), "method %s should have signature %s", actual, expectFmt)
97 } 97 }
98 } 98 }
99 99
100 func argjoin(x []string) string { 100 func argjoin(x []string) string {
101 y := make([]string, len(x)) 101 y := make([]string, len(x))
102 for i, s := range x { 102 for i, s := range x {
103 if s[0] == '=' { 103 if s[0] == '=' {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 printer.Fprint(&f.b, f.fset, actual) 160 printer.Fprint(&f.b, f.fset, actual)
161 return f.b.String() == expect 161 return f.b.String() == expect
162 } 162 }
163 163
164 func (t *BadTypeUsedInTests) Scan(x fmt.ScanState, c byte) { // ERROR "should ha ve signature Scan" 164 func (t *BadTypeUsedInTests) Scan(x fmt.ScanState, c byte) { // ERROR "should ha ve signature Scan"
165 } 165 }
166 166
167 type BadInterfaceUsedInTests interface { 167 type BadInterfaceUsedInTests interface {
168 ReadByte() byte // ERROR "should have signature ReadByte" 168 ReadByte() byte // ERROR "should have signature ReadByte"
169 } 169 }
OLDNEW
« no previous file with comments | « src/cmd/vet/main.go ('k') | no next file » | no next file with comments »

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