-
Notifications
You must be signed in to change notification settings - Fork 69
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
enum values are not generated correctly when the first value is discarded #86
Comments
As a workaround, you can do |
@erizocosmico 👍 thanks! |
@smola on a second thought, we can't do anything to solve that on the proteus side. Protobuf enums must start at 0 (https://developers.google.com/protocol-buffers/docs/proto3#enum) If you want the enums to match you'll have to start at 0. Talk to @Serabe tomorrow IRL. |
@smola one thing you could do is naming the invalid value, instead of using type Role uint64
const (
Invalid Role = iota
Foo
Bar
...
) It's done extensively in the stdlib, so I don't think is a completely bad solution (example: https://golang.org/src/go/ast/scope.go?s=3516:3532#L127). The drawback of this would be that If that is not an OK solution for you guys, we'd have to look into options for respecting the mapping, but we can't promise there will be a solution for this, since enum values must start with 0 no matter what. |
Ping @smola |
1 similar comment
Ping @smola |
looks good to me |
It seems that if you define an enum using
_ = iota
, the values in Go will start at1
, while the generated proto will start at0
.I couldn't really verify this yet.
This is where I'm seeing divergences:
https://github.com/bblfsh/sdk/blob/master/uast/uast.go
https://github.com/bblfsh/sdk/blob/master/uast/generated.proto
(
Roles
enum)The text was updated successfully, but these errors were encountered: