mirror of
https://github.com/golang/go
synced 2024-11-18 14:24:44 -07:00
cmd/vet/all: remove printf hacks
Now that vet loads from source, fmt can always be correctly resolved, so the fmt.Formatter type is always available, so we can reinstate the check. Change-Id: I17f0c7fccf6960c9415de8774b15123135d57be8 Reviewed-on: https://go-review.googlesource.com/37692 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
8a93546d68
commit
85bae0a9df
@ -182,14 +182,6 @@ var ignorePathPrefixes = [...]string{
|
|||||||
"cmd/go/testdata/",
|
"cmd/go/testdata/",
|
||||||
"cmd/vet/testdata/",
|
"cmd/vet/testdata/",
|
||||||
"go/printer/testdata/",
|
"go/printer/testdata/",
|
||||||
// fmt_test contains a known bad format string.
|
|
||||||
// We cannot add it to any given whitelist,
|
|
||||||
// because it won't show up for any non-host platform,
|
|
||||||
// due to deficiencies in vet.
|
|
||||||
// Just whitelist the whole file.
|
|
||||||
// TODO: If vet ever uses go/loader and starts working off source,
|
|
||||||
// this problem will likely go away.
|
|
||||||
"fmt/fmt_test.go",
|
|
||||||
// Ignore pprof for the moment to get the builders happy.
|
// Ignore pprof for the moment to get the builders happy.
|
||||||
// TODO: Fix all the issues and reinstate.
|
// TODO: Fix all the issues and reinstate.
|
||||||
"cmd/vendor/github.com/google/pprof",
|
"cmd/vendor/github.com/google/pprof",
|
||||||
@ -209,28 +201,15 @@ func (p platform) vet() {
|
|||||||
w := make(whitelist)
|
w := make(whitelist)
|
||||||
w.load(p.os, p.arch)
|
w.load(p.os, p.arch)
|
||||||
|
|
||||||
env := append(os.Environ(), "GOOS="+p.os, "GOARCH="+p.arch, "CGO_ENABLED=0")
|
|
||||||
|
|
||||||
// 'go tool vet .' is considerably faster than 'go vet ./...'
|
// 'go tool vet .' is considerably faster than 'go vet ./...'
|
||||||
// TODO: The unsafeptr checks are disabled for now,
|
// TODO: The unsafeptr checks are disabled for now,
|
||||||
// because there are so many false positives,
|
// because there are so many false positives,
|
||||||
// and no clear way to improve vet to eliminate large chunks of them.
|
// and no clear way to improve vet to eliminate large chunks of them.
|
||||||
// And having them in the whitelists will just cause annoyance
|
// And having them in the whitelists will just cause annoyance
|
||||||
// and churn when working on the runtime.
|
// and churn when working on the runtime.
|
||||||
args := []string{"tool", "vet", "-unsafeptr=false", "-source"}
|
cmd := exec.Command(cmdGoPath, "tool", "vet", "-unsafeptr=false", "-source", ".")
|
||||||
if p != hostPlatform {
|
|
||||||
// When not checking the host platform, vet gets confused by
|
|
||||||
// the fmt.Formatters in cmd/compile,
|
|
||||||
// so just skip the printf checks on non-host platforms for now.
|
|
||||||
// There's not too much platform-specific code anyway.
|
|
||||||
// TODO: If vet ever uses go/loader and starts working off source,
|
|
||||||
// this problem will likely go away.
|
|
||||||
args = append(args, "-printf=false")
|
|
||||||
}
|
|
||||||
args = append(args, ".")
|
|
||||||
cmd := exec.Command(cmdGoPath, args...)
|
|
||||||
cmd.Dir = filepath.Join(runtime.GOROOT(), "src")
|
cmd.Dir = filepath.Join(runtime.GOROOT(), "src")
|
||||||
cmd.Env = env
|
cmd.Env = append(os.Environ(), "GOOS="+p.os, "GOARCH="+p.arch, "CGO_ENABLED=0")
|
||||||
stderr, err := cmd.StderrPipe()
|
stderr, err := cmd.StderrPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -13,6 +13,9 @@ go/types/scope.go: method WriteTo(w io.Writer, n int, recurse bool) should have
|
|||||||
|
|
||||||
// False positives.
|
// False positives.
|
||||||
|
|
||||||
|
// Test of how fmt handles nil.
|
||||||
|
fmt/fmt_test.go: arg nil for printf verb %s of wrong type: untyped nil
|
||||||
|
|
||||||
// Nothing much to do about cross-package assembly. Unfortunate.
|
// Nothing much to do about cross-package assembly. Unfortunate.
|
||||||
runtime/asm_ARCHSUFF.s: [GOARCH] cannot check cross-package assembly function: call is in package reflect
|
runtime/asm_ARCHSUFF.s: [GOARCH] cannot check cross-package assembly function: call is in package reflect
|
||||||
runtime/asm_ARCHSUFF.s: [GOARCH] cannot check cross-package assembly function: Equal is in package bytes
|
runtime/asm_ARCHSUFF.s: [GOARCH] cannot check cross-package assembly function: Equal is in package bytes
|
||||||
|
@ -3,5 +3,7 @@
|
|||||||
// Issue 18609
|
// Issue 18609
|
||||||
crypto/x509/root_windows.go: unreachable code
|
crypto/x509/root_windows.go: unreachable code
|
||||||
|
|
||||||
|
path/filepath/path_windows_test.go: possible formatting directive in Fatal call
|
||||||
|
|
||||||
runtime/sys_windows_ARCHSUFF.s: [GOARCH] sigtramp: function sigtramp missing Go declaration
|
runtime/sys_windows_ARCHSUFF.s: [GOARCH] sigtramp: function sigtramp missing Go declaration
|
||||||
runtime/sys_windows_ARCHSUFF.s: [GOARCH] onosstack: unknown variable usec; offset 0 is fn+0(FP)
|
runtime/sys_windows_ARCHSUFF.s: [GOARCH] onosstack: unknown variable usec; offset 0 is fn+0(FP)
|
||||||
|
Loading…
Reference in New Issue
Block a user