util/goroutines: let ScrubbedGoroutineDump get only current stack

ScrubbedGoroutineDump previously only returned the stacks of all
goroutines. I also want to be able to use this for only the current
goroutine's stack. Add a bool param to support both ways.

Updates tailscale/corp#5149

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-06-23 12:43:55 -07:00
committed by Brad Fitzpatrick
parent fbacc0bd39
commit 7c1068b7ac
4 changed files with 8 additions and 7 deletions

View File

@ -6,7 +6,7 @@ package goroutines
import "testing"
func TestScrubbedGoroutineDump(t *testing.T) {
t.Logf("Got:\n%s\n", ScrubbedGoroutineDump())
t.Logf("Got:\n%s\n", ScrubbedGoroutineDump(true))
}
func TestScrubHex(t *testing.T) {