handles: print pointer handle on panic.

This commit is contained in:
Patrick Steinhardt 2015-04-24 10:08:32 +02:00
parent e919653755
commit 7ee534d0c5
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package git package git
import ( import (
"fmt"
"sync" "sync"
"unsafe" "unsafe"
) )
@ -72,7 +73,7 @@ func (v *HandleList) Get(handle unsafe.Pointer) interface{} {
v.RLock() v.RLock()
if _, ok := v.set[slot]; !ok { if _, ok := v.set[slot]; !ok {
panic("invalid pointer handle") panic(fmt.Sprintf("invalid pointer handle: %p", handle))
} }
ptr := v.handles[slot] ptr := v.handles[slot]