-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Updated S parameter according to the Gerrit API #48
Conversation
…API ("The `S` or `start` query parameter can be supplied to skip a number of changes from the list.")
@@ -365,8 +365,7 @@ type QueryChangeOptions struct { | |||
QueryOptions | |||
|
|||
// The S or start query parameter can be supplied to skip a number of changes from the list. | |||
Skip int `url:"S,omitempty"` | |||
Start int `url:"start,omitempty"` |
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.
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 there is an unexpecting behaviour if both fields are used. This is why I suggested to remove this uncertainty. And to be honest, I do not like the Gerrit parameter name "start" because it is very misleading: Gerrit skips the first n
values, but does not start at n
th value - it should be called start_after
or just skip
.
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.
So here's my opinion:
- Field should be named
Skip
since that mirrors the name used in other option structure. - Technically speaking
Skip
should actually be namedStart
since that mirrors what Gerrit's own documentation mentions. However, we shouldn't change that now because that would break a whole lot of code. - For now we should keep
Start
andSkip
and:- Return an error if both are used. @michaeldorner's right that the current situation is a bit unexpected and we don't really know what the behavior is as a result. However....
- If
Start
is used andSkip
is not, setSkip = Start
(and only have the json tags onSkip
). That will keep existing code from breaking immediately. - Go does have a way of documenting deprecation: https://blog.golang.org/godoc-documenting-go-code
Sometimes a struct field, function, type, or even a whole package becomes redundant or unnecessary, but must be kept for compatibility with existing programs. To signal that an identifier should not be used, add a paragraph to its doc comment that begins with "Deprecated:" followed by some information about the deprecation.
The above suggestions seems like it would fix the odd behaviors, not break existing code unless that code is already broken and make it clear what the path for migration is. I'd probably be more inclined to break it if needed to be changed everywhere or there were no other options.
Thoughts?
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.
Sounds good! @michaeldorner Would you mind changing the PR in this way @opalmer suggested?
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.
Sure, give me some days.
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.
Any news here?
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.
Not yet, but on my desk. :)
Codecov Report
@@ Coverage Diff @@
## master #48 +/- ##
=======================================
Coverage 21.23% 21.23%
=======================================
Files 21 21
Lines 1775 1775
=======================================
Hits 377 377
Misses 1353 1353
Partials 45 45
Continue to review full report at Codecov.
|
Hey @michaeldorner, |
Sorry for the delay and even more sorry for forgetting about it. I will fix it as soon as possible (hopefully on the weekend). |
With the current solution, go-gerrit checks if
The other What do you think? |
The way we treated Skip and Start parameters was inconsistent and wrong. In some calls we send both parameters (s, start, S). This causes and undefined behaviour at Gerrit itself. Additional the Skip/Start parameters are numbers and not strings. Here we fixed the Go types. Thanks a lot to @michaeldorner for his initial work in #48 Related: - #48
Thanks a lot, @michaeldorner for your work on this. I will close this and we continue in #98. |
changed all occurrences of the
S
parameter according to the Gerrit API ("TheS
orstart
query parameter can be supplied to skip a number of changes from the list.")