You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
461 B

package blockchain
// this package identifies the 2nd level caller of this function
// this is done to ensure checks regarding locking etc and to be sure no spuros calls are possible
import "runtime"
func CallerName() string {
pc, _, _, ok := runtime.Caller(1)
details := runtime.FuncForPC(pc)
if ok && details != nil {
//fmt.Printf("called from %s\n", details.Name()) // we should only give last parse after .
return details.Name()
}
return ""
}