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
adds checks for protobuf struct tags #707
Conversation
@git-hulk reviews are welcome |
rule/struct-tag.go
Outdated
for _, opt := range tag.Options { | ||
if _, err := strconv.Atoi(opt); err == nil { | ||
_, alreadySeen := w.usedTagNbr[opt] | ||
fmt.Printf("opt %s already seen? %v\n", opt, alreadySeen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove this print line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops! My bad
rule/struct-tag.go
Outdated
if alreadySeen { | ||
return fmt.Sprintf("duplicated tag number %s", opt), false | ||
} | ||
w.usedTagNbr[opt] = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
014 and 14 will NOT regard as duplicate tag number since we use raw string as key, but I think no one will do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified the code to use ints as key
removes debug println
This PR adds support of protobuf struct tags to the rule
struct-tag