runtime/debug: stack test fail when GOROOT='/usr/local/go/'

Fixes: #65506
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
This commit is contained in:
guoguangwu 2024-02-20 14:54:31 +08:00
parent 117164f9e3
commit a616066dbf
1 changed files with 6 additions and 1 deletions

View File

@ -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