Skip to content

Commit 58fe966

Browse files
committed
Fix linter
1 parent 965d46d commit 58fe966

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

hack/tools/release/notes/github.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,13 @@ type githubCommitter struct {
5151
Date time.Time `json:"date"`
5252
}
5353

54-
// getDiff calls the `compare` endpoint.
55-
func (c githubClient) getDiff(base, head string) (githubDiff, error) {
56-
diff := githubDiff{}
57-
if err := c.runGHAPICommand(fmt.Sprintf("repos/%s/compare/%s...%s?per_page=1'", c.repo, base, head), &diff); err != nil {
58-
return githubDiff{}, err
59-
}
60-
return diff, nil
61-
}
62-
6354
// getDiffAllCommits calls the `compare` endpoint, iterating over all pages and aggregating results.
6455
func (c githubClient) getDiffAllCommits(base, head string) (*githubDiff, error) {
6556
pageSize := 250
6657
url := fmt.Sprintf("repos/%s/compare/%s...%s", c.repo, base, head)
6758

68-
diff, commits, err := iterate(c, url, pageSize, nil, func(new *githubDiff) ([]githubCommitNode, int) {
69-
return new.Commits, new.Total
59+
diff, commits, err := iterate(c, url, pageSize, nil, func(page *githubDiff) ([]githubCommitNode, int) {
60+
return page.Commits, page.Total
7061
})
7162
if err != nil {
7263
return nil, err
@@ -158,8 +149,8 @@ func (c githubClient) listMergedPRs(after, before time.Time, baseBranches ...str
158149
searchQuery += "+base:" + strings.Join(baseBranches, "+base:")
159150
}
160151

161-
_, prs, err := iterate(c, "search/issues", pageSize, []string{"q=" + searchQuery}, func(new *githubPRList) ([]githubPR, int) {
162-
return new.Items, new.Total
152+
_, prs, err := iterate(c, "search/issues", pageSize, []string{"q=" + searchQuery}, func(page *githubPRList) ([]githubPR, int) {
153+
return page.Items, page.Total
163154
})
164155
if err != nil {
165156
return nil, err
@@ -179,7 +170,7 @@ func (c githubClient) runGHAPICommand(url string, response any) error {
179170
return json.Unmarshal(out, response)
180171
}
181172

182-
type extractFunc[T, C any] func(newPage *T) (pageElements []C, totalElements int)
173+
type extractFunc[T, C any] func(page *T) (pageElements []C, totalElements int)
183174

184175
func iterate[T, C any](client githubClient, url string, pageSize int, extraQueryArgs []string, extract extractFunc[T, C]) (*T, []C, error) {
185176
page := 0

hack/tools/release/notes/main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,15 @@ func defaultBranchForNewTag(newTag semver.Version) string {
195195
} else if len(newTag.Pre) == 2 && newTag.Pre[0].VersionStr == "rc" && newTag.Pre[1].VersionNum >= 1 {
196196
// for the second or later RCs, we use the release branch since we cut this branch with the first RC
197197
return releaseBranchForVersion(newTag)
198-
} else {
199-
// for any other pre release, we always cut from main
200-
// this includes all beta releases and the first RC
201-
return "main"
202198
}
203-
} else {
204-
// If it's a patch, we use the release branch
205-
return releaseBranchForVersion(newTag)
199+
200+
// for any other pre release, we always cut from main
201+
// this includes all beta releases and the first RC
202+
return "main"
206203
}
204+
205+
// If it's a patch, we use the release branch
206+
return releaseBranchForVersion(newTag)
207207
}
208208

209209
func releaseBranchForVersion(version semver.Version) string {

0 commit comments

Comments
 (0)