proto: file “EntryProtocol.proto“ has a name conflict over 解决方案

panic: proto: file “EntryProtocol.proto” has a name conflict over com.alibaba.otter.canal.protocol.HEARTBEAT
See https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict
goroutine 1 [running]:
google.golang.org/protobuf/reflect/protoregistry.glob…func1(0x1495ed8, 0xc000001480, 0x14731a0, 0xc000124be0, 0x129b5c0)
/go/pkg/mod/google.golang.org/[email protected]/reflect/protoregistry/registry.go:54 +0x25f
google.golang.org/protobuf/reflect/protoregistry.(*Files).RegisterFile.func1(0x1495ed8, 0xc000001480)
/go/pkg/mod/google.golang.org/[email protected]/reflect/protoregistry/registry.go:152 +0x342
google.golang.org/protobuf/reflect/protoregistry.rangeTopLevelDescriptors(0x149a678, 0xc00040e540, 0xc000287710)
/go/pkg/mod/google.golang.org/[email protected]/reflect/protoregistry/registry.go:399 +0xd9
google.golang.org/protobuf/reflect/protoregistry.(*Files).RegisterFile(0xc0001a1770, 0x149a678, 0xc00040e540, 0x0, 0x0)
/go/pkg/mod/google.golang.org/[email protected]/reflect/protoregistry/registry.go:147 +0x557
google.golang.org/protobuf/internal/filedesc.Builder.Build(0x0, 0x0, 0xc00040a400, 0xa5f, 0xc00, 0x800000003, 0x0, 0x14800b8, 0xc00027b320, 0x14884b8, …)
/go/pkg/mod/google.golang.org/[email protected]/internal/filedesc/build.go:113 +0x1aa
github.com/golang/protobuf/proto.RegisterFile(0x12f52c7, 0x13, 0x1c04740, 0x42f, 0x42f)
/go/pkg/mod/github.com/golang/[email protected]/proto/registry.go:48 +0x148
github.com/withlin/canal-go/protocol.init.3()
/go/pkg/mod/github.com/withlin/[email protected]/protocol/EntryProtocol.pb.go:3896 +0x5a

错误原因是命名冲突。
对于包github.com/golang/protobuf来说
v1.5.2 命名冲突的报错是panic
v1.4.3 命名冲突的报错是warning
所以第一个解决方案是把版本降低到v1.4.3

canal的v1.1.1已经修复了此问题,也可以把canal的版本改为v1.1.1
github issue链接
v1.1.1里Entry在"github.com/withlin/canal-go/protocol/entry"里

你可能感兴趣的:(Go,#,项目-Bug解决,golang,github,java)