Fixes more Paginations loops with value not being reset, and wrong value cloud be returned #1493
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
All this endpoints are susceptible to returning wrong data due to the Struct not getting reset for every iteration of the loop.
I fixed it by moving the variable declaration to inside the loop.
This is related to my other PR #1482 that fixed this for a single api endpoint.
I also found this PR that accomplished the same result in a different way #1016 . If you prefer this method, let me know. I can change them all to be in the same way.
And there is also this PR #1447 that is still missing the change-log. I cloud remove the 3 cases that PR fixes from mine, in case you want to merge that one too.
Has your change been tested?
Yes,
go test ./... --race
, and also some API calls.But as I mentioned in #1482, I was not able to create tests that fail without this change, but it happens in runtime.
Most of the tests in this repo do not cover pagination.
Types of changes
What sort of change does your code introduce/modify?
Checklist:
and relies on stable APIs.