Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m.XXX_unrecognized undefined #111

Open
jpfaria opened this issue Apr 9, 2019 · 1 comment
Open

m.XXX_unrecognized undefined #111

jpfaria opened this issue Apr 9, 2019 · 1 comment
Labels

Comments

@jpfaria
Copy link

jpfaria commented Apr 9, 2019

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)

@jamesrr39
Copy link

I had the same error and found golang/protobuf#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.

@dennwc dennwc added the bug label Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants