@@ -1394,7 +1394,7 @@ func TestScanSnapshotSyntheticTwoSnapshots(t *testing.T) {
13941394 93 ,
13951395 ),
13961396 newCallLocal (
1397- "main.glob. .func9" ,
1397+ "main.init .func9" ,
13981398 Args {},
13991399 pathJoin (ppDir , "main.go" ),
14001400 315 ,
@@ -1813,7 +1813,7 @@ func testPanicArgsElided(t *testing.T, s *Snapshot, b *bytes.Buffer, ppDir strin
18131813 },
18141814 pathJoin (ppDir , "main.go" ),
18151815 58 ),
1816- newCallLocal ("main.glob. .func1" , Args {}, pathJoin (ppDir , "main.go" ), 134 ),
1816+ newCallLocal ("main.init .func1" , Args {}, pathJoin (ppDir , "main.go" ), 134 ),
18171817 newCallLocal ("main.main" , Args {}, pathJoin (ppDir , "main.go" ), 340 ),
18181818 },
18191819 },
@@ -1852,7 +1852,7 @@ func testPanicMismatched(t *testing.T, s *Snapshot, b *bytes.Buffer, ppDir strin
18521852 Args {},
18531853 pathJoin (ppDir , "internal" , "incorrect" , "correct.go" ),
18541854 7 ),
1855- newCallLocal ("main.glob. .func20" , Args {}, pathJoin (ppDir , "main.go" ), 314 ),
1855+ newCallLocal ("main.init .func20" , Args {}, pathJoin (ppDir , "main.go" ), 314 ),
18561856 newCallLocal ("main.main" , Args {}, pathJoin (ppDir , "main.go" ), 340 ),
18571857 },
18581858 },
@@ -1986,7 +1986,7 @@ func testPanicStr(t *testing.T, s *Snapshot, b *bytes.Buffer, ppDir string) {
19861986 }}}},
19871987 pathJoin (ppDir , "main.go" ),
19881988 50 ),
1989- newCallLocal ("main.glob. .func19" , Args {}, pathJoin (ppDir , "main.go" ), 307 ),
1989+ newCallLocal ("main.init .func19" , Args {}, pathJoin (ppDir , "main.go" ), 307 ),
19901990 newCallLocal ("main.main" , Args {}, pathJoin (ppDir , "main.go" ), 340 ),
19911991 },
19921992 },
@@ -2025,7 +2025,7 @@ func testPanicUTF8(t *testing.T, s *Snapshot, b *bytes.Buffer, ppDir string) {
20252025 // Call in this situation.
20262026 pathJoin (ppDir , "internal" , "utf8" , "utf8.go" ),
20272027 10 ),
2028- newCallLocal ("main.glob. .func21" , Args {}, pathJoin (ppDir , "main.go" ), 322 ),
2028+ newCallLocal ("main.init .func21" , Args {}, pathJoin (ppDir , "main.go" ), 322 ),
20292029 newCallLocal ("main.main" , Args {}, pathJoin (ppDir , "main.go" ), 340 ),
20302030 },
20312031 },
@@ -2350,7 +2350,7 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
23502350 t .Fatal ("expected Locked" )
23512351 }
23522352 // This is a change detector on internal/main.go.
2353- want := Stack {Calls : []Call {newCallLocal ("main.main" , Args {}, pathJoin (pwebDir , "main.go" ), 145 )}}
2353+ want := Stack {Calls : []Call {newCallLocal ("main.main in goroutine 1 " , Args {}, pathJoin (pwebDir , "main.go" ), 145 )}}
23542354 compareStacks (t , & b .Signature .CreatedBy , & want )
23552355 for i := range b .Signature .Stack .Calls {
23562356 if strings .HasPrefix (b .Signature .Stack .Calls [i ].ImportPath , "github.com/mattn/go-colorable" ) {
@@ -2364,7 +2364,7 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
23642364 {
23652365 want := Stack {
23662366 Calls : []Call {
2367- newCallLocal ("main.main" , Args {}, pathJoin (pwebDir , "main.go" ), 63 ),
2367+ newCallLocal ("main.main in goroutine 1 " , Args {}, pathJoin (pwebDir , "main.go" ), 63 ),
23682368 },
23692369 }
23702370 zapStacks (t , & want , & b .CreatedBy )
@@ -2374,8 +2374,8 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
23742374 t .Fatalf ("expected 1 goroutine for the signature, got %d" , l )
23752375 }
23762376 if runtime .GOOS == "windows" {
2377- if l := len (b .Stack .Calls ); l != 5 {
2378- t .Fatalf ("expected %d calls, got %d" , 5 , l )
2377+ if got , want := len (b .Stack .Calls ), 4 ; got != want {
2378+ t .Fatalf ("expected %d calls, got %d" , want , got )
23792379 }
23802380 if s := b .Stack .Calls [0 ].RelSrcPath ; s != "runtime/syscall_windows.go" {
23812381 t .Fatalf ("expected %q file, got %q" , "runtime/syscall_windows.go" , s )
@@ -2396,6 +2396,7 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
23962396 }
23972397 }
23982398 // Process the golang.org/x/sys call specifically.
2399+ callIdx := 1
23992400 path := "golang.org/x/sys/unix"
24002401 fn := "Nanosleep"
24012402 mainOS := "main_unix.go"
@@ -2409,21 +2410,22 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
24092410 }
24102411 if runtime .GOOS == "windows" {
24112412 // This changes across Go version, this check is super fragile.
2413+ callIdx = 0
24122414 path = "syscall"
24132415 fn = "Syscall"
24142416 mainOS = "main_windows.go"
24152417 prefix = "runtime/syscall_windows.go"
24162418 expectVersion = false
24172419 }
2418- if b .Stack .Calls [1 ].Func .ImportPath != path || b .Stack .Calls [1 ].Func .Name != fn {
2419- t .Fatalf ("expected %q & %q, got %#v" , path , fn , b .Stack .Calls [1 ].Func )
2420+ if b .Stack .Calls [callIdx ].Func .ImportPath != path || b .Stack .Calls [callIdx ].Func .Name != fn {
2421+ t .Fatalf ("expected %q & %q, got %#v" , path , fn , b .Stack .Calls [callIdx ].Func )
24202422 }
2421- if ! strings .HasPrefix (b .Stack .Calls [1 ].RelSrcPath , prefix ) {
2422- t .Fatalf ("expected %q, got %q" , prefix , b .Stack .Calls [1 ].RelSrcPath )
2423+ if ! strings .HasPrefix (b .Stack .Calls [callIdx ].RelSrcPath , prefix ) {
2424+ t .Fatalf ("expected %q, got %q" , prefix , b .Stack .Calls [callIdx ].RelSrcPath )
24232425 }
24242426 if expectVersion {
24252427 // Assert that it's using v0.1.0 format.
2426- ver := strings .SplitN (b .Stack .Calls [1 ].RelSrcPath [len (prefix ):], "/" , 2 )[0 ]
2428+ ver := strings .SplitN (b .Stack .Calls [callIdx ].RelSrcPath [len (prefix ):], "/" , 2 )[0 ]
24272429 re := regexp .MustCompile (`^v\d+\.\d+\.\d+$` )
24282430 if ! re .MatchString (ver ) {
24292431 t .Fatalf ("unexpected version string %q" , ver )
@@ -2438,7 +2440,7 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
24382440 pathJoin (pwebDir , "main.go" ),
24392441 65 ),
24402442 }
2441- got := b .Stack .Calls [2 :]
2443+ got := b .Stack .Calls [callIdx + 1 :]
24422444 if ver := internaltest .GetGoMinorVersion (); (ver > 0 && ver < 18 && ! is64Bit ) || runtime .GOOS == "windows" {
24432445 // TODO(maruel): Fix check on Windows.
24442446 // On go1.17 on 32 bits this is failing but not on go1.18, so only
0 commit comments