diff --git a/src/runtime/debug/stack_test.go b/src/runtime/debug/stack_test.go index 88d4ad0c0f..2c1863bcc1 100644 --- a/src/runtime/debug/stack_test.go +++ b/src/runtime/debug/stack_test.go @@ -101,7 +101,12 @@ func TestStack(t *testing.T) { } filePrefix := "" if fileGoroot != "" { - filePrefix = filepath.ToSlash(fileGoroot) + "/src/" + fileGoroot = filepath.ToSlash(filepath.Clean(fileGoroot)) + if fileGoroot == "/" { + filePrefix = "/src/" + } else { + filePrefix = fileGoroot + "/src/" + } } n := 0