Skip to content

Commit c60ccf9

Browse files
authored
Merge pull request cli#540 from Dasio/goto-remove
Use break label instead of goto
2 parents 7a222d8 + 327dae9 commit c60ccf9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

api/queries_pr.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) ([]
497497
}
498498
}`
499499

500-
prs := []PullRequest{}
500+
var prs []PullRequest
501501
pageLimit := min(limit, 100)
502502
variables := map[string]interface{}{}
503503

@@ -555,7 +555,7 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) ([]
555555
variables[name] = val
556556
}
557557
}
558-
558+
loop:
559559
for {
560560
variables["limit"] = pageLimit
561561
var data response
@@ -571,17 +571,16 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) ([]
571571
for _, edge := range prData.Edges {
572572
prs = append(prs, edge.Node)
573573
if len(prs) == limit {
574-
goto done
574+
break loop
575575
}
576576
}
577577

578578
if prData.PageInfo.HasNextPage {
579579
variables["endCursor"] = prData.PageInfo.EndCursor
580580
pageLimit = min(pageLimit, limit-len(prs))
581-
continue
581+
} else {
582+
break
582583
}
583-
done:
584-
break
585584
}
586585

587586
return prs, nil

0 commit comments

Comments
 (0)