Source: golang-goprotobuf
Version: 1.3.4-2
Severity: normal
Dear Maintainer,
I'm trying to package github.com/jhump/protoreflect, which depends on
golang-goprotobuf.
While building the test files, I get hit by these error messages:
~~~~
panic: no such file: "google/protobuf/compiler/plugin.proto"
goroutine 1 [running]:
github.com/jhump/protoreflect/desc/protoparse.init.1()
/build/golang-github-jhump-protoreflect-XXyGrR/golang-github-jhump-protoreflect-1.8.1/_build/src/github.com/jhump/protoreflect/desc/protoparse/std_imports.go:46
+0x2c6
FAIL github.com/jhump/protoreflect/desc/protoprint 0.019s
FAIL github.com/jhump/protoreflect/dynamic [build failed]
~~~~
Looking into the test file desc/protoparse/std_imports.go [1], I see
that the code tries to import a number of paths, including:
~~~~
standardFilenames := []string{
"google/protobuf/any.proto",
"google/protobuf/api.proto",
"google/protobuf/compiler/plugin.proto",
"google/protobuf/descriptor.proto",
~~~~
After much research, I found out that the filename registered for
'compiler/plugin.proto'is wrong in the generated code:
~~~~
# cd /usr/share/gocode/src/github.com/golang/protobuf/protoc-gen-go/plugin
# grep -ri RegisterFile
plugin.pb.go: proto.RegisterFile("plugin.proto",
fileDescriptor_22a625af4bc1cc87)
~~~~
For reference, this same file in the source package (ie. before code
regeneration, cf. [2]):
~~~~
# cd golang-goprotobuf-debian-packaging
# git checkout debian/1.3.4-2
# cd protoc-gen-go/plugin
# grep -ri RegisterFile
plugin.pb.go:func init() {
proto.RegisterFile("google/protobuf/compiler/plugin.proto", fileDescriptor0) }
~~~~
This is the right value, ie. 'google/protobuf/compiler/plugin.proto'.
It looks like the debian patch that forces code regeneration is wrong
and breaks things.
[1]:
https://github.com/jhump/protoreflect/blob/master/desc/protoparse/std_imports.go
[2]:
https://salsa.debian.org/go-team/packages/golang-goprotobuf/-/blob/debian/1.3.4-2/protoc-gen-go/plugin/plugin.pb.go