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

Linter fails on negative enum values #140

Closed
iorbitearth opened this issue Dec 8, 2020 · 3 comments
Closed

Linter fails on negative enum values #140

iorbitearth opened this issue Dec 8, 2020 · 3 comments
Assignees

Comments

@iorbitearth
Copy link

Given the following proto file:

syntax = "proto2";

enum TestNegativeValue {
  NEGATIVE_CONSTANT = -1;
  ZERO_CONSTANT = 0;
  POSITIVE_CONSTANT = 1;
}

protolint fails on the negative enum constant:

$ protolint negative_enum_val.proto 
found "\"-\"(Token=0, Pos=negative_enum_val.proto:4:23)" but expected [intLit] at /go/pkg/mod/github.com/yoheimuta/go-protoparser/v4@v4.2.0/parser/enum.go:242:found "-" but expected [;]. Use -v for more details

$ echo $?
2

Using the Linux 0.26.0 release protolint_0.26.0_Linux_x86_64.tar.gz

Not an issue for protoc. For now I'm excluding certain proto files that have negative enums in the protolint config file.

@yoheimuta
Copy link
Owner

@iorbitearth Thank you for letting me know!
I created an issue which is yoheimuta/go-protoparser#57.

@yoheimuta
Copy link
Owner

@iorbitearth v0.28.2 allows negative enum values.
Please give it a try!

@iorbitearth
Copy link
Author

That fixed it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants