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

doctl: pagination is 1 indexed, not 0 indexed #79

Merged
merged 1 commit into from
May 23, 2016

Conversation

jphines
Copy link
Contributor

@jphines jphines commented May 23, 2016

I think this is the bug, but I'll let CI run the tests.

Essentially pagination is 1 indexed, and not 0 indexed. So we re-fetch the first page, but never fetch the second, getting a "second page" full of dupes.

@jphines
Copy link
Contributor Author

jphines commented May 23, 2016

Fixes #78

@aybabtme
Copy link
Contributor

this i := 1 and i := 2 stuff feels fragile to me, I feel there's got to be a way to do this with resp.Links

@jphines
Copy link
Contributor Author

jphines commented May 23, 2016

@aybabtme clearly it is fragile because its broken

@@ -80,7 +80,7 @@ func PaginateResp(gen Generator) ([]interface{}, error) {
}

// start with second page
for i := 1; i < lp; i++ {
for i := 2; i <= lp; i++ {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you increment opt.Page++ instead? feels more obvious to me, since the :=2 here really just means "the page after what we just fetched"

@jphines jphines force-pushed the jphines/storage/doctl-pagination branch from 64f8c16 to 735a754 Compare May 23, 2016 19:33
@jphines
Copy link
Contributor Author

jphines commented May 23, 2016

image

@aybabtme
Copy link
Contributor

🚢

@jphines jphines merged commit 4ab6c43 into master May 23, 2016
@jphines jphines deleted the jphines/storage/doctl-pagination branch May 23, 2016 19:47
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.

2 participants