]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/test: fix go vet warnings
authorIan Lance Taylor <iant@golang.org>
Tue, 13 Oct 2015 17:05:13 +0000 (10:05 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 13 Oct 2015 17:53:20 +0000 (17:53 +0000)
Fixes these warnings from go vet:
buildid_linux.go:25: no formatting directive in Fatalf call
callback.go:180: arg pc[i] for printf verb %p of wrong type: uintptr
env.go:34: possible misuse of unsafe.Pointer
issue7665.go:22: possible misuse of unsafe.Pointer

Change-Id: I83811b9c10c617139713a626b4a34ab05564d4fe
Reviewed-on: https://go-review.googlesource.com/15802
Reviewed-by: David Crawshaw <crawshaw@golang.org>
misc/cgo/test/buildid_linux.go
misc/cgo/test/callback.go
misc/cgo/test/env.go
misc/cgo/test/issue7665.go

index a3a86edfca883dc651bd2ec16efeb2f27159ca8f..2641dd5a61be6bb1705eb5f18f09d3be4cf5b0d9 100644 (file)
@@ -22,7 +22,7 @@ func testBuildID(t *testing.T) {
                if os.IsNotExist(err) {
                        t.Skip("no /proc/self/exe")
                }
-               t.Fatalf("opening /proc/self/exe: ", err)
+               t.Fatal("opening /proc/self/exe: ", err)
        }
        defer f.Close()
 
index bff770fa8d97e9f474177224f7a75d37ac5338c2..3967e711d1efd4c2bdd9742a7f655b231731b9ac 100644 (file)
@@ -177,7 +177,7 @@ func testCallbackCallers(t *testing.T) {
        for i := 0; i < n; i++ {
                f := runtime.FuncForPC(pc[i])
                if f == nil {
-                       t.Fatalf("expected non-nil Func for pc %p", pc[i])
+                       t.Fatalf("expected non-nil Func for pc %d", pc[i])
                }
                fname := f.Name()
                // Remove the prepended pathname from automatically
index 8d3ba5877b87df3c19c009f24d6febb97a63fac8..b2081b72837a02a40531387a21cbf2dd24a77e71 100644 (file)
@@ -31,7 +31,7 @@ func testSetEnv(t *testing.T) {
        keyc := C.CString(key)
        defer C.free(unsafe.Pointer(keyc))
        v := C.getenv(keyc)
-       if v == (*C.char)(unsafe.Pointer(uintptr(0))) {
+       if uintptr(unsafe.Pointer(v)) == 0 {
                t.Fatal("getenv returned NULL")
        }
        vs := C.GoString(v)
index 4f36dce7566f81e49bc99664c5f043fbb52f9eb8..da9713178da07cedb7ec89b75bb02f1ebc362727 100644 (file)
@@ -19,7 +19,7 @@ var bad7665 unsafe.Pointer = C.f7665
 var good7665 uintptr = uintptr(C.f7665)
 
 func test7665(t *testing.T) {
-       if bad7665 == nil || bad7665 != unsafe.Pointer(good7665) {
+       if bad7665 == nil || uintptr(bad7665) != good7665 {
                t.Errorf("ptrs = %p, %#x, want same non-nil pointer", bad7665, good7665)
        }
 }