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 number of arguments in printf #23564

octomarat opened this issue Jan 26, 2018 · 1 comment


None yet
4 participants
Copy link

commented Jan 26, 2018

Please answer these questions before submitting your issue. Thanks!

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

go1.9.3 darwin/amd64

What did you do?

Run the following program:

package main

func main() {
	fmt.Printf("%[1]d \n", 1, 2, 3)
	fmt.Printf("%d \n", 1, 2, 3)

It prints the first line without problems, and prints the second one with errors. As far I understand, when there are explicit arguments in the format string, fmt does not report errors about extra arguments (see: #22867).

Now, run go vet on this file.

What did you expect to see?

Error is reported only for the second line.

What did you see instead?

Errors are reported for both lines.

@mvdan mvdan self-assigned this Jan 26, 2018

@mvdan mvdan added the NeedsFix label Jan 26, 2018

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


This comment has been minimized.

Copy link

commented Jan 29, 2018

Change mentions this issue: cmd/vet: extra args if any formats are indexed are ok

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

@gopherbot gopherbot closed this in 14f8027 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.