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>
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()
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
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)
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)
}
}