go.tools/cmd/vet: delete the word "only" from a warning
No semantic change. R=dsymonds, rsc CC=golang-dev https://golang.org/cl/10516043
This commit is contained in:
parent
40caf1ff72
commit
6740bb0838
|
|
@ -459,7 +459,7 @@ func (f *File) argCanBeChecked(call *ast.CallExpr, formatArg int, isStar bool, s
|
||||||
}
|
}
|
||||||
// This is the argument number relative to the format: Printf("%s", "hi") will give 1 for the "hi".
|
// This is the argument number relative to the format: Printf("%s", "hi") will give 1 for the "hi".
|
||||||
arg := argNum - state.firstArg + 1 // People think of arguments as 1-indexed.
|
arg := argNum - state.firstArg + 1 // People think of arguments as 1-indexed.
|
||||||
f.Badf(call.Pos(), "missing argument for %s %s: need %d, only have %d", state.name, verb, arg, len(call.Args)-state.firstArg)
|
f.Badf(call.Pos(), "missing argument for %s %s: need %d, have %d", state.name, verb, arg, len(call.Args)-state.firstArg)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ func PrintfTests() {
|
||||||
Printf("hi") // ok
|
Printf("hi") // ok
|
||||||
const format = "%s %s\n"
|
const format = "%s %s\n"
|
||||||
Printf(format, "hi", "there")
|
Printf(format, "hi", "there")
|
||||||
Printf(format, "hi") // ERROR "missing argument for Printf verb %s: need 2, only have 1"
|
Printf(format, "hi") // ERROR "missing argument for Printf verb %s: need 2, have 1"
|
||||||
f := new(stringer)
|
f := new(stringer)
|
||||||
f.Warn(0, "%s", "hello", 3) // ERROR "possible formatting directive in Warn call"
|
f.Warn(0, "%s", "hello", 3) // ERROR "possible formatting directive in Warn call"
|
||||||
f.Warnf(0, "%s", "hello", 3) // ERROR "wrong number of args for format in Warnf call"
|
f.Warnf(0, "%s", "hello", 3) // ERROR "wrong number of args for format in Warnf call"
|
||||||
|
|
@ -134,8 +134,8 @@ func PrintfTests() {
|
||||||
// Bad argument reorderings.
|
// Bad argument reorderings.
|
||||||
Printf("%[xd", 3) // ERROR "illegal syntax for printf argument index"
|
Printf("%[xd", 3) // ERROR "illegal syntax for printf argument index"
|
||||||
Printf("%[x]d", 3) // ERROR "illegal syntax for printf argument index"
|
Printf("%[x]d", 3) // ERROR "illegal syntax for printf argument index"
|
||||||
Printf("%[3]*s", "hi", 2) // ERROR "missing argument for Printf indirect \*: need 3, only have 2"
|
Printf("%[3]*s", "hi", 2) // ERROR "missing argument for Printf indirect \*: need 3, have 2"
|
||||||
fmt.Sprintf("%[3]d", 2) // ERROR "missing argument for Sprintf verb %d: need 3, only have 1"
|
fmt.Sprintf("%[3]d", 2) // ERROR "missing argument for Sprintf verb %d: need 3, have 1"
|
||||||
Printf("%[2]*.[1]*[3]d", 2, "hi", 4) // ERROR "arg .hi. for \* in printf format not of type int"
|
Printf("%[2]*.[1]*[3]d", 2, "hi", 4) // ERROR "arg .hi. for \* in printf format not of type int"
|
||||||
// Something that satisfies the error interface.
|
// Something that satisfies the error interface.
|
||||||
var e error
|
var e error
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue