Print names of functions from runtime.Stack

I am trying to find a way where I can print the names of the function that are present in the stack trace of all the current goroutines.

In the above example, I am able to find that main.main() calls main.mine(), but how can I extract the name of that, and also how can I get to know that the main.another() function is also invoked?

I think what you’re looking for is which lets you build up a []uintptr slice of the function pointers in your call stack. Here’s an example:

After that, you then want to use like this:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.