mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: rewrite %1v and %2v formats to %S and %L (short and long)
- also consistently use %v instead of %s when we have a (gc) Formatter - rewrite done automatically using Formats test in -u (update) mode - manual update of format strings that were not single string constants - updated fmt.go, fmt_test.go accordingly - fmt_test: permit "%T" always Change-Id: I8f0704286aba5704600ad0c4a4484005b79b905d Reviewed-on: https://go-review.googlesource.com/28954 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
af8ca3387a
commit
6537e18f02
40 changed files with 206 additions and 209 deletions
|
|
@ -15,7 +15,8 @@
|
|||
// A new knownFormats table based on the found formats is printed
|
||||
// when the test is run in verbose mode (-v flag). The table
|
||||
// needs to be updated whenever a new (type, format) combination
|
||||
// is found and the format verb is not 'v' (as in "%v").
|
||||
// is found and the format verb is not 'v' or 'T' (as in "%v" or
|
||||
// "%T").
|
||||
//
|
||||
// Run as: go test -run Formats [-u][-v]
|
||||
//
|
||||
|
|
@ -120,8 +121,8 @@ func TestFormats(t *testing.T) {
|
|||
}
|
||||
|
||||
// report an error if the format is unknown and this is the first
|
||||
// time we see it; ignore "%v" which is always considered valid
|
||||
if !known && !found && in != "%v" {
|
||||
// time we see it; ignore "%v" and "%T" which are always valid
|
||||
if !known && !found && in != "%v" && in != "%T" {
|
||||
t.Errorf("%s: unknown format %q for %s argument", posString(p.arg), in, typ)
|
||||
}
|
||||
|
||||
|
|
@ -543,34 +544,31 @@ var knownFormats = map[string]string{
|
|||
"*cmd/compile/internal/gc.Mpflt %v": "",
|
||||
"*cmd/compile/internal/gc.Mpint %v": "",
|
||||
"*cmd/compile/internal/gc.Node %#v": "",
|
||||
"*cmd/compile/internal/gc.Node %+1v": "",
|
||||
"*cmd/compile/internal/gc.Node %+S": "",
|
||||
"*cmd/compile/internal/gc.Node %+v": "",
|
||||
"*cmd/compile/internal/gc.Node %0j": "",
|
||||
"*cmd/compile/internal/gc.Node %1v": "",
|
||||
"*cmd/compile/internal/gc.Node %2v": "",
|
||||
"*cmd/compile/internal/gc.Node %L": "",
|
||||
"*cmd/compile/internal/gc.Node %S": "",
|
||||
"*cmd/compile/internal/gc.Node %j": "",
|
||||
"*cmd/compile/internal/gc.Node %p": "",
|
||||
"*cmd/compile/internal/gc.Node %s": "",
|
||||
"*cmd/compile/internal/gc.Node %v": "",
|
||||
"*cmd/compile/internal/gc.Sym % v": "",
|
||||
"*cmd/compile/internal/gc.Sym %+v": "",
|
||||
"*cmd/compile/internal/gc.Sym %-v": "",
|
||||
"*cmd/compile/internal/gc.Sym %01v": "",
|
||||
"*cmd/compile/internal/gc.Sym %1v": "",
|
||||
"*cmd/compile/internal/gc.Sym %0S": "",
|
||||
"*cmd/compile/internal/gc.Sym %S": "",
|
||||
"*cmd/compile/internal/gc.Sym %p": "",
|
||||
"*cmd/compile/internal/gc.Sym %s": "",
|
||||
"*cmd/compile/internal/gc.Sym %v": "",
|
||||
"*cmd/compile/internal/gc.Type % -v": "",
|
||||
"*cmd/compile/internal/gc.Type %#v": "",
|
||||
"*cmd/compile/internal/gc.Type %+v": "",
|
||||
"*cmd/compile/internal/gc.Type %- v": "",
|
||||
"*cmd/compile/internal/gc.Type %-1v": "",
|
||||
"*cmd/compile/internal/gc.Type %-S": "",
|
||||
"*cmd/compile/internal/gc.Type %-v": "",
|
||||
"*cmd/compile/internal/gc.Type %01v": "",
|
||||
"*cmd/compile/internal/gc.Type %1v": "",
|
||||
"*cmd/compile/internal/gc.Type %2v": "",
|
||||
"*cmd/compile/internal/gc.Type %0S": "",
|
||||
"*cmd/compile/internal/gc.Type %L": "",
|
||||
"*cmd/compile/internal/gc.Type %S": "",
|
||||
"*cmd/compile/internal/gc.Type %p": "",
|
||||
"*cmd/compile/internal/gc.Type %s": "",
|
||||
"*cmd/compile/internal/gc.Type %v": "",
|
||||
"*cmd/compile/internal/ssa.Block %s": "",
|
||||
"*cmd/compile/internal/ssa.Block %v": "",
|
||||
|
|
@ -607,17 +605,14 @@ var knownFormats = map[string]string{
|
|||
"cmd/compile/internal/gc.Level %d": "",
|
||||
"cmd/compile/internal/gc.Level %v": "",
|
||||
"cmd/compile/internal/gc.Node %#v": "",
|
||||
"cmd/compile/internal/gc.Nodes %#s": "",
|
||||
"cmd/compile/internal/gc.Nodes %#v": "",
|
||||
"cmd/compile/internal/gc.Nodes %+v": "",
|
||||
"cmd/compile/internal/gc.Nodes %.v": "",
|
||||
"cmd/compile/internal/gc.Nodes %v": "",
|
||||
"cmd/compile/internal/gc.Op %#v": "",
|
||||
"cmd/compile/internal/gc.Op %d": "",
|
||||
"cmd/compile/internal/gc.Op %s": "",
|
||||
"cmd/compile/internal/gc.Op %v": "",
|
||||
"cmd/compile/internal/gc.Val %#v": "",
|
||||
"cmd/compile/internal/gc.Val %s": "",
|
||||
"cmd/compile/internal/gc.Val %T": "",
|
||||
"cmd/compile/internal/gc.Val %v": "",
|
||||
"cmd/compile/internal/gc.initKind %d": "",
|
||||
"cmd/compile/internal/ssa.BlockKind %s": "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue