If you have access to the source code in its original location when running code, you could use this code get the variable name. It uses runtime stack trace to figure out the path and line number of the caller, then parses the original source AST to find out the variable name. It won't work if the source code is missing or moved to a different location.
f := func(n int) int {
return n + 1
}
fmt.Println("Name of func:", gist6418290.GetExprAsString(f))
// Output:
//f
Now, it works in practice and was a fun challenge to implement, but I don't recommend you actually use it... just because I'm sure there's a simpler solution for your particular problem (it looks like you already found it).