I'm looking at using runtime.Stack to parse information on goroutines (looking for leaks). The issue is that runtime.Stack returns its output as a string that has to be parsed, and it requires a byte buffer input of sufficient size. I know there are some libraries like gostackparse and panicparse, but neither of them work for GODEBUG=tracebackancestors=<n> (where n > 0). I need this because I want to verify leaks for goroutines which are descendents of the current stack frame.
Is there a way to get the structured output of runtime.Stack that works with tracebackancestors?