Day: March 23, 2017

  • Golang: Get the function caller’s name

    Problem Consider this code: package main import “fmt” func foo() { // foo() wants to know who called it fmt.Println(“HI”) } func main() { foo() } In the function foo, we want to get the name of the function (and preferably file name and number ) that called it. Solution We can get this information…