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: false positive in Printf recursive Stringer check with non-matching String() functions #30441

Open
reillywatson opened this Issue Feb 27, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@reillywatson
Copy link
Contributor

commented Feb 27, 2019

What version of Go are you using (go version)?

$ go version
1.12

Does this issue reproduce with the latest release?

Yes!

What operating system and processor architecture are you using (go env)?

play.golang.org

What did you do?

package main

import (
	"fmt"
)

type Foo int
func (f Foo) String() (string, error) {
	return "", fmt.Errorf("%v", f)
}

func main() {
	s, err := Foo(1).String()
	fmt.Println(s, err)
}

https://play.golang.org/p/-zpHBBPnetu

What did you expect to see?

No vet output

What did you see instead?

prog.go:9:13: Errorf format %v with arg f causes recursive String method call

@gopherbot

This comment has been minimized.

Copy link

commented Feb 27, 2019

Change https://golang.org/cl/164217 mentions this issue: cmd/vet: verify potentially-recursive Stringers are actuually Stringers

@bcmills

This comment has been minimized.

Copy link
Member

commented Feb 27, 2019

@bcmills bcmills added this to the Go1.13 milestone Feb 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.