m.XXX_unrecognized undefined
hello,
when I run my app, the follow error is returning:
JPFARIA-MacBook-Pro:server jpfaria$ go run main.go
gitlab.b2w/joao.faria/knativegrpcexample
../generated.pb.go:288:6: m.XXX_unrecognized undefined (type *User has no field or method XXX_unrecognized) ../generated.pb.go:289:24: m.XXX_unrecognized undefined (type *User has no field or method XXX_unrecognized) ../generated.pb.go:351:6: m.XXX_unrecognized undefined (type *User has no field or method XXX_unrecognized) ../generated.pb.go:352:13: m.XXX_unrecognized undefined (type *User has no field or method XXX_unrecognized) ../generated.pb.go:564:5: m.XXX_unrecognized undefined (type *User has no field or method XXX_unrecognized)
I had the same error and found https://github.com/golang/protobuf/issues/594
Seeing as it now seems like the XXX_unrecognized field should be in the struct (ie, they would be in the struct if you used protoc to generate all of your Go code), I found that simply adding it to the struct worked for me. If you want to keep your structs clean of protobuf-specific fields, I found a not-so-bad workaround, of wrapping it in another struct, like this:
//proteus:generate
type PBPersonWrapper struct {
Person
XXX_unrecognized []byte
}
type Person struct {
Name string
Age uint
}
It's not ideal, but it works.