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 about wrong argument for verb #23552

Closed
octomarat opened this issue Jan 25, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@octomarat
Copy link

commented Jan 25, 2018

Please answer these questions before submitting your issue. Thanks!

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

go1.9.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

Run go vet on the following file:

package main

import "fmt"

type T int

func (t T) String() string { return "t" }

func main() {
	fmt.Printf("%s", [1]T{0})
	fmt.Printf("%s", []T{0})
}

What did you expect to see?

No errors.

What did you see instead?

For the first line go vet reports arg [1]T{0} for printf verb %s of wrong type: [1]main.T. This is false positive as file executes normally and prints [t][t].

@mvdan mvdan self-assigned this Jan 25, 2018

@mvdan mvdan added the NeedsFix label Jan 25, 2018

@mvdan mvdan added this to the Go1.11 milestone Jan 25, 2018

@mvdan

This comment has been minimized.

Copy link
Member

commented Jan 25, 2018

Thank you for taking the time to file these!

@gopherbot

This comment has been minimized.

Copy link

commented Jan 29, 2018

Change https://golang.org/cl/90455 mentions this issue: cmd/vet: %s is valid for an array of stringer

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.10 Jan 29, 2018

@gopherbot gopherbot closed this in 4072608 Jan 30, 2018

@golang golang locked and limited conversation to collaborators Jan 30, 2019

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