From: =?utf-8?b?T3R0byBLZWvDpGzDpGluZW4=?= <otto@debian.org>
Date: Fri, 22 Aug 2025 21:27:42 +0000
Subject: Fix remaining stack_test failures

Addresses the remaining test failures in `stack_test.go`:

1.  The expected output for `TestFrameFormat` incorrectly referenced
    `github.com/pkg/errors` instead of `github.com/pingcap/errors`
    in the package path. This has been updated to reflect the correct
    package.

    === RUN   TestFrameFormat
        stack_test.go:125: test 12: line 2: fmt.Sprintf("%+v", err):
             got: "github.com/pingcap/errors.init\n\t/tmp/build/source/debian/.build/upstream/src/github.com/pingcap/errors/stack_test.go:10"
            want: "github.com/pingcap/errors.init\n\t.+/github.com/pkg/errors/stack_test.go:10"
    --- FAIL: TestFrameFormat (0.00s)


2.  The regular expression used in `TestStackTrace` to match function
    names was too specific (`.func.*`). This caused failures when the
    compiler generated slightly different function names (e.g.,
    `.func1`, `.func2`). The regex has been broadened to `.*` to
    account for variations in compiler output, ensuring the test passes
    reliably across different environments.

    === RUN   TestStackTrace
        stack_test.go:203: test 5: line 1: fmt.Sprintf("%+v", err):
             got: "github.com/pingcap/errors.TestStackTrace.TestStackTrace.func2.func3\n\t/tmp/build/source/debian/.build/upstream/src/github.com/pingcap/errors/stack_test.go:179"
            want: "github.com/pingcap/errors.TestStackTrace.func.*\n\t.+/github.com/pingcap/errors/stack_test.go:179"
    --- FAIL: TestStackTrace (0.00s)

---
 stack_test.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/stack_test.go b/stack_test.go
index 9e47ae5..81f1f5a 100644
--- a/stack_test.go
+++ b/stack_test.go
@@ -114,7 +114,7 @@ func TestFrameFormat(t *testing.T) {
 		Frame(initpc),
 		"%+v",
 		"github.com/pingcap/errors.init\n" +
-			"\t.+/github.com/pkg/errors/stack_test.go:10",
+			"\t.+/github.com/pingcap/errors/stack_test.go:10",
 	}, {
 		Frame(0),
 		"%v",
@@ -179,9 +179,9 @@ func TestStackTrace(t *testing.T) {
 				return Errorf("hello %s", fmt.Sprintf("world"))
 			}()
 		}()), []string{
-			`github.com/pingcap/errors.TestStackTrace.func.*` +
+			`github.com/pingcap/errors.TestStackTrace.*` +
 				"\n\t.+/github.com/pingcap/errors/stack_test.go:179", // this is the stack of Errorf
-			`github.com/pingcap/errors.TestStackTrace.func.*` +
+			`github.com/pingcap/errors.TestStackTrace.*` +
 				"\n\t.+/github.com/pingcap/errors/stack_test.go:180", // this is the stack of Errorf's caller
 			"github.com/pingcap/errors.TestStackTrace\n" +
 				"\t.+/github.com/pingcap/errors/stack_test.go:181", // this is the stack of Errorf's caller's caller
