I\'m trying to use Go\'s reflection system to retrieve the name of a function but I get an empty string when calling the Name method on its type. Is this the expected behavi
import runtime func funcName() string { pc, _, _, _ := runtime.Caller(1) nameFull := runtime.FuncForPC(pc).Name() // main.foo nameEnd := filepath.Ext(nameFull) // .foo name := strings.TrimPrefix(nameEnd, ".") // foo return name }