Skip to content

Commit 944a19a

Browse files
committed
pkg/repo: avoid make for slice init
Initializing the slice with empty PRs broke PR-based KEP loading: - the PR file loading code tried pulling files for PR number 0 - which returned an error - which prevented any PR-based KEPs from loading Opt to initiliaze slices as explicitly empty, since we don't really need the efficiency gains of pre-allocation here.
1 parent a514b84 commit 944a19a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/repo/query.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (r *Repo) Query(opts *QueryOpts) ([]*api.Proposal, error) {
9999
}
100100
}
101101

102-
allKEPs := make([]*api.Proposal, 0, 10)
102+
allKEPs := []*api.Proposal{}
103103
// load the KEPs for each listed SIG
104104
for _, sig := range opts.Groups {
105105
// KEPs in the local filesystem
@@ -132,7 +132,7 @@ func (r *Repo) Query(opts *QueryOpts) ([]*api.Proposal, error) {
132132
allowedApprover := sliceToMap(opts.Approver)
133133
allowedParticipant := sliceToMap(opts.Participant)
134134

135-
results := make([]*api.Proposal, 0, 10)
135+
results := []*api.Proposal{}
136136
for _, k := range allKEPs {
137137
if k == nil {
138138
return nil, errors.New("one of the KEPs in query was nil")

pkg/repo/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ func (r *Repo) loadKEPPullRequests(sig string) ([]*api.Proposal, error) {
331331
}
332332
}
333333

334-
kepPRs := make([]*github.PullRequest, 10)
334+
kepPRs := []*github.PullRequest{}
335335
sigLabel := strings.Replace(sig, "-", "/", 1)
336336
logrus.Debugf("Searching list of %v PRs for %v/%v with labels: [%v, %v]", len(r.allPRs), remoteOrg, remoteRepo, sigLabel, proposalLabel)
337337
for _, pr := range r.allPRs {

0 commit comments

Comments
 (0)