golang/go

cmd/vet: incorrect printf "invalid argument index" with ... argument

Open

#34,007 创建于 2019年9月1日

在 GitHub 查看
 (2 评论) (1 反应) (0 负责人)Go (19,008 fork)batch import
AnalysisNeedsFixhelp wanted

仓库指标

Star
 (133,883 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

tip (79669dc705)

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

darwin/amd64

What did you do?

https://play.golang.org/p/uIeIGQWBhgB

package main

import (
	"fmt"
)

func main() {
	s := []interface{}{"Hello", "playground"}
	fmt.Printf("%[2]s\n", s...)
}

What did you expect to see?

No vet warning.

I think this is a valid program, which prints "playground" as intended. It doesn't seem like a potential bug to me.

What did you see instead?

./prog.go:9:2: Printf format has invalid argument index [2]

贡献者指南