]> Cypherpunks repositories - gostls13.git/commit
cmd/vet: extra args if any formats are indexed are ok
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 29 Jan 2018 10:35:39 +0000 (10:35 +0000)
committerIan Lance Taylor <iant@golang.org>
Tue, 30 Jan 2018 14:36:35 +0000 (14:36 +0000)
commit14f8027a10040b99773bcd5cb452579926cf2758
tree4dd5f965fb2726248112f4a9c190a4363b1065f9
parent4072608b58e32b761068538f254799669fdb9b1a
cmd/vet: extra args if any formats are indexed are ok

For example, the following program is valid:

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

If any of the formats are indexed, fmt will not complain about unused
extra arguments. See #22867 for more detail.

Make vet follow the same logic, to avoid erroring on programs that would
run without fmt complaining.

Fixes #23564.

Change-Id: Ic9dede5d4c37d1cd4fa24714216944897b5bb7cc
Reviewed-on: https://go-review.googlesource.com/90495
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
src/cmd/vet/print.go
src/cmd/vet/testdata/print.go