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

adds checks for protobuf struct tags #707

Merged
merged 2 commits into from Jul 15, 2022
Merged

Conversation

chavacava
Copy link
Collaborator

This PR adds support of protobuf struct tags to the rule struct-tag

@chavacava chavacava requested a review from mgechev July 14, 2022 09:43
@chavacava
Copy link
Collaborator Author

@git-hulk reviews are welcome

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)
Copy link
Contributor

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops! My bad

if alreadySeen {
return fmt.Sprintf("duplicated tag number %s", opt), false
}
w.usedTagNbr[opt] = true
Copy link
Contributor

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.

Copy link
Collaborator Author

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

@mgechev mgechev merged commit 60e1ae4 into master Jul 15, 2022
@mgechev mgechev deleted the feature/protobuf-struct-tag branch July 15, 2022 18:15
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

Successfully merging this pull request may close these issues.

None yet

3 participants