KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Given a function, is it possible to get its name? Say: func foo() { } func GetFunctionName(i interface{}) string { // ... } func main() { // Will print "name: foo" fmt.Println("name:", GetFunctionName(foo)) } I was told that runtime.FuncForPC would help, but I failed to understand how to use it.
Tags (comma-separated)
Save Edits
Cancel