summaryrefslogtreecommitdiff
path: root/src/cmd/vet/method.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/vet/method.go')
-rw-r--r--src/cmd/vet/method.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/vet/method.go b/src/cmd/vet/method.go
index 41cb40ff9..bf982dc7a 100644
--- a/src/cmd/vet/method.go
+++ b/src/cmd/vet/method.go
@@ -55,6 +55,9 @@ var canonicalMethods = map[string]MethodSig{
}
func (f *File) checkCanonicalMethod(id *ast.Ident, t *ast.FuncType) {
+ if !vet("methods") {
+ return
+ }
// Expected input/output.
expect, ok := canonicalMethods[id.Name]
if !ok {
@@ -87,9 +90,7 @@ func (f *File) checkCanonicalMethod(id *ast.Ident, t *ast.FuncType) {
fmt.Fprintf(&f.b, "<%s>", err)
}
actual := f.b.String()
- if strings.HasPrefix(actual, "func(") {
- actual = actual[4:]
- }
+ actual = strings.TrimPrefix(actual, "func")
actual = id.Name + actual
f.Warnf(id.Pos(), "method %s should have signature %s", actual, expectFmt)