Created
July 8, 2021 01:58
-
-
Save sirenko/62af2ced43e393c23058e1201bd1504e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"reflect" | |
"runtime" | |
"strings" | |
) | |
// GetFuncName returns function name referenced by 'f' | |
func GetFuncName(f interface{}) string { | |
return strings.Split(runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name(), ".")[1] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment