Update internal/codespaces/api/api.go

Co-authored-by: Jose Garcia <josebalius@github.com>
This commit is contained in:
Gabriel Ramírez 2021-10-05 15:33:16 -05:00 committed by GitHub
parent e793a5961d
commit 4314f734e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -228,12 +228,11 @@ func (a *API) ListCodespaces(ctx context.Context) ([]*Codespace, error) {
return nil, fmt.Errorf("error unmarshaling response: %w", err)
}
if len(response.Codespaces) > 0 {
codespaces = append(codespaces, response.Codespaces...)
page++
} else {
break
if len(response.Codespaces) == 0 {
break
}
codespaces = append(codespaces, response.Codespaces...)
}
return codespaces, nil