-
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
add support for proteus:",(protobuf field id)"
in golang tag
#109
base: master
Are you sure you want to change the base?
Conversation
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.
CI failures seems unrelated, let me fix it first.
The change looks good in general, bu please add some tests to check if it works as intended.
scanner/scanner.go
Outdated
if len(tags) == 0 { | ||
return 0 | ||
} | ||
i, err := strconv.Atoi(tags[0]) |
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 think it may be better to use proteus:",101"
notation - it will be easier to extend later.
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.
Thank you for your suggestion, as you wish.
Please rebase on the latest master - it should fix the CI. |
Thanks to dennwc for advice it may be better to use proteus:",101" notation - it will be easier to extend later.
694cddc
to
6204512
Compare
Signed-off-by: Denys Smirnov <[email protected]>
proteus:"(protobuf field id)"
in golang tagproteus:",(protobuf field id)"
in golang tag
add test in transform_test and scanner_test. add an example of use.
Add tests and example |
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.
Looks good now, but need to regenerate files.
Also please sign your commits as described here (DCO):
https://github.com/src-d/guide/blob/master/engineering/licensing.md#developer-certificate-of-origin
// Field3 int | ||
|
||
// 4th field, use `proteus:",4"` forward compatible | ||
Field4 int `proteus:",4"` |
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 should also update the generated files in the example folder - this field will affect some of those files.
@@ -5,4 +5,9 @@ package categories | |||
type CategoryOptions struct { | |||
ShowPrices bool | |||
CanBuy bool | |||
// The next field was deleted. |
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.
// The next field was deleted. | |
// The next field was added initially (with a number 3) and was deprecated later. |
// The next field was deleted. | ||
// Field3 int | ||
|
||
// 4th field, use `proteus:",4"` forward compatible |
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.
// 4th field, use `proteus:",4"` forward compatible | |
// Field4 uses `proteus:",4"` for forward compatibility, see Field3 comment above. |
Now you can specify the ID of the peoto file in the following way:
This example will generate the following protobuf message.