mirror of
https://github.com/golang/go
synced 2024-09-30 06:14:31 -06:00
cmd/vet: re-vendor x/tools upstream for printf verb fix
This pulls in the x/tools fix from https://go-review.googlesource.com/c/tools/+/202041 so that cmd/vet won't flag %x/%X verbs incorrectly for floating-point and complex types. Fixes #34993 Change-Id: I68d89a19d95fe6ad336e87d12d56f03556974086 Reviewed-on: https://go-review.googlesource.com/c/go/+/202083 Run-TryBot: Caleb Spare <cespare@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
e9c994954f
commit
72275c0dea
@ -8,5 +8,5 @@ require (
|
|||||||
golang.org/x/arch v0.0.0-20190815191158-8a70ba74b3a1
|
golang.org/x/arch v0.0.0-20190815191158-8a70ba74b3a1
|
||||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c
|
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c
|
||||||
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 // indirect
|
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 // indirect
|
||||||
golang.org/x/tools v0.0.0-20190925211824-e4ea94538f5b
|
golang.org/x/tools v0.0.0-20191018203202-04252eccb9d5
|
||||||
)
|
)
|
||||||
|
@ -14,7 +14,7 @@ golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 h1:vsphBvatvfbhlb4PO1BYSr9dz
|
|||||||
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/tools v0.0.0-20190925211824-e4ea94538f5b h1:gyG4T6EqWG9fqSgT0VbHhzp8bHbFux5mvlgz1gUkEaQ=
|
golang.org/x/tools v0.0.0-20191018203202-04252eccb9d5 h1:TFUhCYbgGMOGnRxJv+j0iAcxCjk8oGjXXWNejQBhUUs=
|
||||||
golang.org/x/tools v0.0.0-20190925211824-e4ea94538f5b/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191018203202-04252eccb9d5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||||
|
5
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go
generated
vendored
5
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go
generated
vendored
@ -79,7 +79,6 @@ var (
|
|||||||
asmArchArm = asmArch{name: "arm", bigEndian: false, stack: "R13", lr: true}
|
asmArchArm = asmArch{name: "arm", bigEndian: false, stack: "R13", lr: true}
|
||||||
asmArchArm64 = asmArch{name: "arm64", bigEndian: false, stack: "RSP", lr: true}
|
asmArchArm64 = asmArch{name: "arm64", bigEndian: false, stack: "RSP", lr: true}
|
||||||
asmArchAmd64 = asmArch{name: "amd64", bigEndian: false, stack: "SP", lr: false}
|
asmArchAmd64 = asmArch{name: "amd64", bigEndian: false, stack: "SP", lr: false}
|
||||||
asmArchAmd64p32 = asmArch{name: "amd64p32", bigEndian: false, stack: "SP", lr: false}
|
|
||||||
asmArchMips = asmArch{name: "mips", bigEndian: true, stack: "R29", lr: true}
|
asmArchMips = asmArch{name: "mips", bigEndian: true, stack: "R29", lr: true}
|
||||||
asmArchMipsLE = asmArch{name: "mipsle", bigEndian: false, stack: "R29", lr: true}
|
asmArchMipsLE = asmArch{name: "mipsle", bigEndian: false, stack: "R29", lr: true}
|
||||||
asmArchMips64 = asmArch{name: "mips64", bigEndian: true, stack: "R29", lr: true}
|
asmArchMips64 = asmArch{name: "mips64", bigEndian: true, stack: "R29", lr: true}
|
||||||
@ -94,7 +93,6 @@ var (
|
|||||||
&asmArchArm,
|
&asmArchArm,
|
||||||
&asmArchArm64,
|
&asmArchArm64,
|
||||||
&asmArchAmd64,
|
&asmArchAmd64,
|
||||||
&asmArchAmd64p32,
|
|
||||||
&asmArchMips,
|
&asmArchMips,
|
||||||
&asmArchMipsLE,
|
&asmArchMipsLE,
|
||||||
&asmArchMips64,
|
&asmArchMips64,
|
||||||
@ -635,9 +633,6 @@ func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr stri
|
|||||||
case "amd64.LEAQ":
|
case "amd64.LEAQ":
|
||||||
dst = 8
|
dst = 8
|
||||||
addr = true
|
addr = true
|
||||||
case "amd64p32.LEAL":
|
|
||||||
dst = 4
|
|
||||||
addr = true
|
|
||||||
default:
|
default:
|
||||||
switch fn.arch.name {
|
switch fn.arch.name {
|
||||||
case "386", "amd64":
|
case "386", "amd64":
|
||||||
|
4
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
generated
vendored
4
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
generated
vendored
@ -766,8 +766,8 @@ var printVerbs = []printVerb{
|
|||||||
{'U', "-#", argRune | argInt},
|
{'U', "-#", argRune | argInt},
|
||||||
{'v', allFlags, anyType},
|
{'v', allFlags, anyType},
|
||||||
{'w', allFlags, argError},
|
{'w', allFlags, argError},
|
||||||
{'x', sharpNumFlag, argRune | argInt | argString | argPointer},
|
{'x', sharpNumFlag, argRune | argInt | argString | argPointer | argFloat | argComplex},
|
||||||
{'X', sharpNumFlag, argRune | argInt | argString | argPointer},
|
{'X', sharpNumFlag, argRune | argInt | argString | argPointer | argFloat | argComplex},
|
||||||
}
|
}
|
||||||
|
|
||||||
// okPrintfArg compares the formatState to the arguments actually present,
|
// okPrintfArg compares the formatState to the arguments actually present,
|
||||||
|
7
src/cmd/vendor/golang.org/x/tools/go/analysis/validate.go
generated
vendored
7
src/cmd/vendor/golang.org/x/tools/go/analysis/validate.go
generated
vendored
@ -9,13 +9,10 @@ import (
|
|||||||
// Validate reports an error if any of the analyzers are misconfigured.
|
// Validate reports an error if any of the analyzers are misconfigured.
|
||||||
// Checks include:
|
// Checks include:
|
||||||
// that the name is a valid identifier;
|
// that the name is a valid identifier;
|
||||||
// that analyzer names are unique;
|
|
||||||
// that the Requires graph is acyclic;
|
// that the Requires graph is acyclic;
|
||||||
// that analyzer fact types are unique;
|
// that analyzer fact types are unique;
|
||||||
// that each fact type is a pointer.
|
// that each fact type is a pointer.
|
||||||
func Validate(analyzers []*Analyzer) error {
|
func Validate(analyzers []*Analyzer) error {
|
||||||
names := make(map[string]bool)
|
|
||||||
|
|
||||||
// Map each fact type to its sole generating analyzer.
|
// Map each fact type to its sole generating analyzer.
|
||||||
factTypes := make(map[reflect.Type]*Analyzer)
|
factTypes := make(map[reflect.Type]*Analyzer)
|
||||||
|
|
||||||
@ -39,10 +36,6 @@ func Validate(analyzers []*Analyzer) error {
|
|||||||
if !validIdent(a.Name) {
|
if !validIdent(a.Name) {
|
||||||
return fmt.Errorf("invalid analyzer name %q", a)
|
return fmt.Errorf("invalid analyzer name %q", a)
|
||||||
}
|
}
|
||||||
if names[a.Name] {
|
|
||||||
return fmt.Errorf("duplicate analyzer name %q", a)
|
|
||||||
}
|
|
||||||
names[a.Name] = true
|
|
||||||
|
|
||||||
if a.Doc == "" {
|
if a.Doc == "" {
|
||||||
return fmt.Errorf("analyzer %q is undocumented", a)
|
return fmt.Errorf("analyzer %q is undocumented", a)
|
||||||
|
2
src/cmd/vendor/modules.txt
vendored
2
src/cmd/vendor/modules.txt
vendored
@ -31,7 +31,7 @@ golang.org/x/crypto/ssh/terminal
|
|||||||
## explicit
|
## explicit
|
||||||
golang.org/x/sys/unix
|
golang.org/x/sys/unix
|
||||||
golang.org/x/sys/windows
|
golang.org/x/sys/windows
|
||||||
# golang.org/x/tools v0.0.0-20190925211824-e4ea94538f5b
|
# golang.org/x/tools v0.0.0-20191018203202-04252eccb9d5
|
||||||
## explicit
|
## explicit
|
||||||
golang.org/x/tools/go/analysis
|
golang.org/x/tools/go/analysis
|
||||||
golang.org/x/tools/go/analysis/internal/analysisflags
|
golang.org/x/tools/go/analysis/internal/analysisflags
|
||||||
|
5
src/cmd/vet/testdata/print/print.go
vendored
5
src/cmd/vet/testdata/print/print.go
vendored
@ -81,8 +81,8 @@ func PrintfTests() {
|
|||||||
fmt.Printf("%T %T", 3, i)
|
fmt.Printf("%T %T", 3, i)
|
||||||
fmt.Printf("%U %U", 3, i)
|
fmt.Printf("%U %U", 3, i)
|
||||||
fmt.Printf("%v %v", 3, i)
|
fmt.Printf("%v %v", 3, i)
|
||||||
fmt.Printf("%x %x %x %x", 3, i, "hi", s)
|
fmt.Printf("%x %x %x %x %x %x %x", 3, i, "hi", s, x, c, fslice)
|
||||||
fmt.Printf("%X %X %X %X", 3, i, "hi", s)
|
fmt.Printf("%X %X %X %X %X %X %X", 3, i, "hi", s, x, c, fslice)
|
||||||
fmt.Printf("%.*s %d %g", 3, "hi", 23, 2.3)
|
fmt.Printf("%.*s %d %g", 3, "hi", 23, 2.3)
|
||||||
fmt.Printf("%s", &stringerv)
|
fmt.Printf("%s", &stringerv)
|
||||||
fmt.Printf("%v", &stringerv)
|
fmt.Printf("%v", &stringerv)
|
||||||
@ -125,7 +125,6 @@ func PrintfTests() {
|
|||||||
fmt.Printf("%t", 23) // ERROR "Printf format %t has arg 23 of wrong type int"
|
fmt.Printf("%t", 23) // ERROR "Printf format %t has arg 23 of wrong type int"
|
||||||
fmt.Printf("%U", x) // ERROR "Printf format %U has arg x of wrong type float64"
|
fmt.Printf("%U", x) // ERROR "Printf format %U has arg x of wrong type float64"
|
||||||
fmt.Printf("%x", nil) // ERROR "Printf format %x has arg nil of wrong type untyped nil"
|
fmt.Printf("%x", nil) // ERROR "Printf format %x has arg nil of wrong type untyped nil"
|
||||||
fmt.Printf("%X", 2.3) // ERROR "Printf format %X has arg 2.3 of wrong type float64"
|
|
||||||
fmt.Printf("%s", stringerv) // ERROR "Printf format %s has arg stringerv of wrong type .*print.ptrStringer"
|
fmt.Printf("%s", stringerv) // ERROR "Printf format %s has arg stringerv of wrong type .*print.ptrStringer"
|
||||||
fmt.Printf("%t", stringerv) // ERROR "Printf format %t has arg stringerv of wrong type .*print.ptrStringer"
|
fmt.Printf("%t", stringerv) // ERROR "Printf format %t has arg stringerv of wrong type .*print.ptrStringer"
|
||||||
fmt.Printf("%s", embeddedStringerv) // ERROR "Printf format %s has arg embeddedStringerv of wrong type .*print.embeddedStringer"
|
fmt.Printf("%s", embeddedStringerv) // ERROR "Printf format %s has arg embeddedStringerv of wrong type .*print.embeddedStringer"
|
||||||
|
Loading…
Reference in New Issue
Block a user