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

Closed
reillywatson opened this issue Feb 27, 2019 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@reillywatson
Copy link
Contributor

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
Copy link

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

@bcmills
Copy link
Contributor

bcmills commented Feb 27, 2019

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 27, 2019
@bcmills bcmills added this to the Go1.13 milestone Feb 27, 2019
@golang golang locked and limited conversation to collaborators Apr 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants