-
Notifications
You must be signed in to change notification settings - Fork 20
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
Call Validate() when unmarshalling resource name #288
Conversation
59bc82d
to
9a702a7
Compare
cmd/protoc-gen-go-aip/internal/genaip/testdata/test/multipattern/testdata_aip.go
Outdated
Show resolved
Hide resolved
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.
IMO makes sense to Validate()
in the generated methods - good thinking!
9a702a7
to
505461a
Compare
if err != nil { | ||
return err | ||
} | ||
if err := n.Validate(); err != nil { |
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.
You could return the error directly.
return n.Validate()
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.
oh, nice - great suggestion, and so obvious now that I realize the return signature is identical!
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.
fixed
505461a
to
de5dc16
Compare
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.
Sweet!
We are calling
Validate()
on marshalling but not on unmarshalling a resource name. This PR fixes that.