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

Closed
marat-rkh opened this issue Jan 26, 2018 · 1 comment
Closed

cmd/vet: false positive about wrong number of arguments in printf #23564

marat-rkh opened this issue Jan 26, 2018 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@marat-rkh
Copy link

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 The path to resolution is known, but the work has not been done. label Jan 26, 2018
@mvdan mvdan added this to the Go1.11 milestone Jan 26, 2018
@gopherbot
Copy link

Change https://golang.org/cl/90495 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
@golang golang locked and limited conversation to collaborators Jan 30, 2019
@rsc rsc unassigned mvdan Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants