Skip to content

auth.proto 这个名字过于通用,导致非常容易和其他库冲突导致 panic #3

@shizhx

Description

@shizhx

panic 信息如下:

panic: proto: file "auth.proto" is already registered
        See https://protobuf.dev/reference/go/faq#namespace-conflict


goroutine 1 gp=0xc0000061c0 m=0 mp=0x19c1640 [running]:
panic({0xe8de40?, 0xc00005a210?})
        /usr/lib/go/src/runtime/panic.go:804 +0x168 fp=0xc0001457b8 sp=0xc000145708 pc=0x477408
google.golang.org/protobuf/reflect/protoregistry.init.func1({0x1934560?, 0x104c1e0?}, {0x11d7d60, 0xc00005a1f0})
        /home/xxx/go/pkg/mod/google.golang.org/protobuf@v1.34.2/reflect/protoregistry/registry.go:56 +0x1ec fp=0xc000145830 sp=0xc0001457b8 pc=0x610b8c
google.golang.org/protobuf/reflect/protoregistry.(*Files).RegisterFile(0xc000012330, {0x11f0f78, 0xc000585180})
        /home/xxx/go/pkg/mod/google.golang.org/protobuf@v1.34.2/reflect/protoregistry/registry.go:130 +0xb83 fp=0xc0001459c8 sp=0xc000145830 pc=0x611763
google.golang.org/protobuf/internal/filetype.(*resolverByIndex).RegisterFile(0xe5131f?, {0x11f0f78?, 0xc000585180?})
        <autogenerated>:1 +0x2f fp=0xc0001459f0 sp=0xc0001459c8 pc=0x6a44af
google.golang.org/protobuf/internal/filedesc.Builder.Build({{0xe5131f, 0x24}, {0x19662c0, 0x136, 0x136}, 0x0, 0x2, 0x0, 0x1, {0x11dda28, ...}, ...})
        /home/xxx/go/pkg/mod/google.golang.org/protobuf@v1.34.2/internal/filedesc/build.go:112 +0x1d6 fp=0xc000145a58 sp=0xc0001459f0 pc=0x62f536
google.golang.org/protobuf/internal/filetype.Builder.Build({{{0xe5131f, 0x24}, {0x19662c0, 0x136, 0x136}, 0x0, 0x2, 0x0, 0x1, {0x0, ...}, ...}, ...})
        /home/xxx/go/pkg/mod/google.golang.org/protobuf@v1.34.2/internal/filetype/build.go:138 +0x17d fp=0xc000145c30 sp=0xc000145a58 pc=0x6a27bd
github.com/go-gost/plugin/auth/proto.file_auth_proto_init()
        /home/xxx/go/pkg/mod/github.com/go-gost/plugin@v0.2.0/auth/proto/auth.pb.go:241 +0x198 fp=0xc000145e10 sp=0xc000145c30 pc=0xdf58d8

protobuf 的相关坑: golang/protobuf#1122

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions