]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/vet/all: remove printf hacks
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 2 Mar 2017 17:11:03 +0000 (09:11 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 2 Mar 2017 18:43:40 +0000 (18:43 +0000)
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>

src/cmd/vet/all/main.go
src/cmd/vet/all/whitelist/all.txt
src/cmd/vet/all/whitelist/windows.txt

index 317137941cb764bf511ef283c2de0bd07d793a05..9d6bf9ed488ae4d47c8aa8ba6196bb5716f388f8 100644 (file)
@@ -182,14 +182,6 @@ var ignorePathPrefixes = [...]string{
        "cmd/go/testdata/",
        "cmd/vet/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.
        // TODO: Fix all the issues and reinstate.
        "cmd/vendor/github.com/google/pprof",
@@ -209,28 +201,15 @@ func (p platform) vet() {
        w := make(whitelist)
        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 ./...'
        // TODO: The unsafeptr checks are disabled for now,
        // because there are so many false positives,
        // and no clear way to improve vet to eliminate large chunks of them.
        // And having them in the whitelists will just cause annoyance
        // and churn when working on the runtime.
-       args := []string{"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 := exec.Command(cmdGoPath, "tool", "vet", "-unsafeptr=false", "-source", ".")
        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()
        if err != nil {
                log.Fatal(err)
index 3a154e9d23553e63dad7e3a90b7a1e3dee68e9c2..6323c4c2b64bcad962b6b7495bec6bed188907d1 100644 (file)
@@ -13,6 +13,9 @@ go/types/scope.go: method WriteTo(w io.Writer, n int, recurse bool) should have
 
 // 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.
 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
index 2c101aeb980c0e937fc322fe08c2b878cfcd3bb1..1a208ad69745006e949cc154a1b4918556c7bea1 100644 (file)
@@ -3,5 +3,7 @@
 // Issue 18609
 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] onosstack: unknown variable usec; offset 0 is fn+0(FP)