summaryrefslogtreecommitdiff
path: root/src/cmd/vet/method.go
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-03-04 21:27:36 +0100
committerMichael Stapelberg <michael@stapelberg.de>2013-03-04 21:27:36 +0100
commit04b08da9af0c450d645ab7389d1467308cfc2db8 (patch)
treedb247935fa4f2f94408edc3acd5d0d4f997aa0d8 /src/cmd/vet/method.go
parent917c5fb8ec48e22459d77e3849e6d388f93d3260 (diff)
downloadgolang-upstream/1.1_hg20130304.tar.gz
Imported Upstream version 1.1~hg20130304upstream/1.1_hg20130304
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)