Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/vet: incorrect "redundant invocation" report #6148

fsouza opened this issue Aug 14, 2013 · 3 comments

cmd/vet: incorrect "redundant invocation" report #6148

fsouza opened this issue Aug 14, 2013 · 3 comments


Copy link

@fsouza fsouza commented Aug 14, 2013

% cat abc.go
package main

import (

type Person struct {
    name string

func (p *Person) String() string {

func main() {
    p := Person{name: "Gopher"}
    fmt.Printf("%s\n", p.String())
% go vet abc.go
abc.go:17: redundant invocation of String method of p

It's not redundant, because String method requires a pointer receiver. So, *Person
implements the Stringer interface, but Person does not.

Following vet advice produces the wrong result:
Copy link

@robpike robpike commented Aug 15, 2013

Comment 1:

I vote for just reverting the CL that added this. It's not a problem to be explicit
about those methods even when they are unnecessary.

Labels changed: added priority-soon, removed priority-triage, go1.2maybe.

Owner changed to @dsymonds.

Status changed to Accepted.

Copy link

@dsymonds dsymonds commented Aug 15, 2013

Comment 2:

Yeah, I have also tripped over this. It could use the typechecker a little more to work
out whether p has the method on that type, but maybe this is just overstepping govet's
Give me a day to think about it.
Copy link

@dsymonds dsymonds commented Aug 19, 2013

Comment 3:

This issue was closed by revision golang/tools@a7c698b.

Status changed to Fixed.

@fsouza fsouza added fixed labels Aug 19, 2013
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants