Skip to content

Instantly share code, notes, and snippets.

@tenox7
Created June 7, 2023 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenox7/84b8797b1da6b210f8e08d45449c570d to your computer and use it in GitHub Desktop.
Save tenox7/84b8797b1da6b210f8e08d45449c570d to your computer and use it in GitHub Desktop.
returns caller name
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