@@ -1256,6 +1256,10 @@ func testPanicMismatched(t *testing.T, c *Context, b *bytes.Buffer, ppDir string
12561256 if b .String () != "GOTRACEBACK=all\n panic: 42\n \n " {
12571257 t .Fatalf ("output: %q" , b .String ())
12581258 }
1259+ ver := ""
1260+ if ! internaltest .IsUsingModules () {
1261+ ver = ""
1262+ }
12591263 want := []* Goroutine {
12601264 {
12611265 Signature : Signature {
@@ -1268,7 +1272,7 @@ func testPanicMismatched(t *testing.T, c *Context, b *bytes.Buffer, ppDir string
12681272 //
12691273 // Here the package name is "correct". There is no way to deduce
12701274 // this from the stack trace.
1271- "github.com/maruel/panicparse/cmd/panic/internal/incorrect.Panic" ,
1275+ "github.com/maruel/panicparse" + ver + " /cmd/panic/internal/incorrect.Panic" ,
12721276 Args {},
12731277 pathJoin (ppDir , "internal" , "incorrect" , "correct.go" ),
12741278 7 ),
@@ -1321,6 +1325,10 @@ func testPanicUTF8(t *testing.T, c *Context, b *bytes.Buffer, ppDir string) {
13211325 if b .String () != "GOTRACEBACK=all\n panic: 42\n \n " {
13221326 t .Fatalf ("output: %q" , b .String ())
13231327 }
1328+ ver := ""
1329+ if ! internaltest .IsUsingModules () {
1330+ ver = ""
1331+ }
13241332 want := []* Goroutine {
13251333 {
13261334 Signature : Signature {
@@ -1331,7 +1339,7 @@ func testPanicUTF8(t *testing.T, c *Context, b *bytes.Buffer, ppDir string) {
13311339 // This is important to note here the inconsistency in the Go
13321340 // runtime stack generator. The path is escaped, but symbols are
13331341 // not.
1334- "github.com/maruel/panicparse/cmd/panic/internal/%c3%b9tf8.(*Strùct).Pànic" ,
1342+ "github.com/maruel/panicparse" + ver + " /cmd/panic/internal/%c3%b9tf8.(*Strùct).Pànic" ,
13351343 Args {Values : []Arg {{Value : 0xc0000b2e48 }}},
13361344 // See TestCallUTF8 in stack_test.go for exercising the methods on
13371345 // Call in this situation.
@@ -1485,7 +1493,17 @@ func pstCount(s []panicwebSignatureType, t panicwebSignatureType) int {
14851493 return i
14861494}
14871495
1496+ // identifyPanicwebSignature tries to assign one of the predefined signature to
1497+ // the bucket provided.
1498+ //
1499+ // One challenge is that the path will be different depending if this test is
1500+ // run within GOPATH or outside.
14881501func identifyPanicwebSignature (t * testing.T , b * Bucket , pwebDir string ) panicwebSignatureType {
1502+ ver := ""
1503+ if ! isInGOPATH {
1504+ ver = ""
1505+ }
1506+
14891507 // The first bucket (the one calling panic()) is deterministic.
14901508 if b .First {
14911509 if len (b .IDs ) != 1 {
@@ -1511,7 +1529,7 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
15111529 t .Fatalf ("suspicious: %#v" , b )
15121530 return pstUnknown
15131531 }
1514- if b .Stack .Calls [0 ].ImportPath () != "github.com/maruel/panicparse/cmd/panicweb/internal" {
1532+ if b .Stack .Calls [0 ].ImportPath () != "github.com/maruel/panicparse" + ver + " /cmd/panicweb/internal" {
15151533 t .Fatalf ("suspicious: %#v" , b )
15161534 return pstUnknown
15171535 }
0 commit comments