Skip to content

StacktraceEncoder is not support? #1490

Open
@yyle88

Description

@yyle88

Describe the bug
code:

package M我勒个擦

import (
	"testing"

	"go.uber.org/zap"
)

func TestAbc(t *testing.T) {
	// 自定义 zap 配置
	config := zap.NewDevelopmentConfig()

	// 创建 logger
	logger, err := config.Build(zap.AddStacktrace(zap.PanicLevel)) // 在 Panic 级别添加堆栈
	if err != nil {
		t.Fatalf("failed to build logger: %v", err)
	}
	defer logger.Sync()

	funcName(logger)
}

func funcName(log *zap.Logger) {
	defer func() {
		recover()
	}()
	log.Panic("expect TRUE while got FALSE")
}

To Reproduce
run the test code.

Expected behavior
output is:

GOROOT=/opt/homebrew/opt/go/libexec #gosetup
GOPATH=/Users/yyle88/go #gosetup
/opt/homebrew/opt/go/libexec/bin/go test -c -o /Users/yyle88/Library/Caches/JetBrains/GoLand2025.1/tmp/GoLand/___T_test_go.test github.com/yyle88/zaplog/X我勒个擦/M我勒个擦 #gosetup
/opt/homebrew/opt/go/libexec/bin/go tool test2json -t /Users/yyle88/Library/Caches/JetBrains/GoLand2025.1/tmp/GoLand/___T_test_go.test -test.v=test2json -test.paniconexit0 -test.run ^\QTestAbc\E$ #gosetup
=== RUN   TestAbc
2025-03-07T00:14:03.714+0700	PANIC	M我勒个擦/T哈哈哈_test.go:27	expect TRUE while got FALSE
github.com/yyle88/zaplog/X%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6/M%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6.funcName
	/Users/yyle88/go-projects/open/zaplog/X我勒个擦/M我勒个擦/T哈哈哈_test.go:27
github.com/yyle88/zaplog/X%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6/M%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6.TestAbc
	/Users/yyle88/go-projects/open/zaplog/X我勒个擦/M我勒个擦/T哈哈哈_test.go:20
testing.tRunner
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1792
--- PASS: TestAbc (0.00s)
PASS

进程 已完成,退出代码为 0

Additional context
why the out put contains the

X%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6/M%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6

I know it is better not use no-ascii code in the package path.

while as you see. my english is just so so.

so I really need the chinese package path in my project. so can you please provide a stack-trace-encoder set func.

thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions