Created
June 7, 2023 11:18
-
-
Save tenox7/84b8797b1da6b210f8e08d45449c570d to your computer and use it in GitHub Desktop.
returns caller name
This file contains 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
func funcName() string { | |
pc, _, _, _ := runtime.Caller(1) | |
nm := runtime.FuncForPC(pc).Name() | |
dt := strings.Split(nm, ".") | |
return dt[len(dt)-1] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment