diff --git a/src/runtime/debug/stack_test.go b/src/runtime/debug/stack_test.go index 289749ccb4..a704154b12 100644 --- a/src/runtime/debug/stack_test.go +++ b/src/runtime/debug/stack_test.go @@ -105,7 +105,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