From 735a754b90398aaf7bc3d1c75754ace8861d4a12 Mon Sep 17 00:00:00 2001 From: Justin Hines Date: Mon, 23 May 2016 15:00:31 -0400 Subject: [PATCH] doctl: pagination is 1 indexed, not 0 indexed --- do/pagination.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/do/pagination.go b/do/pagination.go index f03307e9f..355fd9a11 100644 --- a/do/pagination.go +++ b/do/pagination.go @@ -52,7 +52,7 @@ func PaginateResp(gen Generator) ([]interface{}, error) { fetchChan := make(chan int, maxFetchPages) var wg sync.WaitGroup - for i := 0; i < 4; i++ { + for i := 0; i < maxFetchPages-1; i++ { wg.Add(1) go func() { for page := range fetchChan { @@ -80,8 +80,9 @@ func PaginateResp(gen Generator) ([]interface{}, error) { } // start with second page - for i := 1; i < lp; i++ { - fetchChan <- i + opt.Page++ + for ; opt.Page <= lp; opt.Page++ { + fetchChan <- opt.Page } close(fetchChan)