chore: update golangci-lint to v2.13.0

Migrate the deprecated gofumpt `extra-rules` to `extra.group-params`, as
the alias now also enables the new `clothe-returns` and `balance-calls`
rules. Disable SA4023, which hangs on go 1.27, see
https://github.com/golangci/golangci-lint/issues/6732.

Apply the resulting modernize fixes, mostly flattening embedded struct
literals and switching errors.As to errors.AsType.

Assisted-by: Claude:Opus 5
This commit is contained in:
silverwind
2026-08-20 06:21:34 +02:00
parent b227ad8a5f
commit bef127f188
173 changed files with 1161 additions and 1659 deletions
+8 -16
View File
@@ -96,10 +96,8 @@ func TestGetMilestones(t *testing.T) {
test := func(sortType string, sortCond func(*issues_model.Milestone) int) {
for _, page := range []int{0, 1} {
milestones, err := db.Find[issues_model.Milestone](t.Context(), issues_model.FindMilestoneOptions{
ListOptions: db.ListOptions{
Page: page,
PageSize: setting.UI.IssuePagingNum,
},
Page: page,
PageSize: setting.UI.IssuePagingNum,
RepoID: repo.ID,
IsClosed: optional.Some(false),
SortType: sortType,
@@ -113,10 +111,8 @@ func TestGetMilestones(t *testing.T) {
assert.True(t, sort.IntsAreSorted(values))
milestones, err = db.Find[issues_model.Milestone](t.Context(), issues_model.FindMilestoneOptions{
ListOptions: db.ListOptions{
Page: page,
PageSize: setting.UI.IssuePagingNum,
},
Page: page,
PageSize: setting.UI.IssuePagingNum,
RepoID: repo.ID,
IsClosed: optional.Some(true),
Name: "",
@@ -229,10 +225,8 @@ func TestGetMilestonesByRepoIDs(t *testing.T) {
test := func(sortType string, sortCond func(*issues_model.Milestone) int) {
for _, page := range []int{0, 1} {
openMilestones, err := db.Find[issues_model.Milestone](t.Context(), issues_model.FindMilestoneOptions{
ListOptions: db.ListOptions{
Page: page,
PageSize: setting.UI.IssuePagingNum,
},
Page: page,
PageSize: setting.UI.IssuePagingNum,
RepoIDs: []int64{repo1.ID, repo2.ID},
IsClosed: optional.Some(false),
SortType: sortType,
@@ -247,10 +241,8 @@ func TestGetMilestonesByRepoIDs(t *testing.T) {
closedMilestones, err := db.Find[issues_model.Milestone](t.Context(),
issues_model.FindMilestoneOptions{
ListOptions: db.ListOptions{
Page: page,
PageSize: setting.UI.IssuePagingNum,
},
Page: page,
PageSize: setting.UI.IssuePagingNum,
RepoIDs: []int64{repo1.ID, repo2.ID},
IsClosed: optional.Some(true),
SortType: sortType,
+3 -9
View File
@@ -89,9 +89,7 @@ func testPullRequestLoadHeadRepo(t *testing.T) {
func testPullRequestsNewest(t *testing.T) {
prs, count, err := issues_model.PullRequests(t.Context(), 1, &issues_model.PullRequestsOptions{
ListOptions: db.ListOptions{
Page: 1,
},
Page: 1,
State: "open",
SortType: "newest",
})
@@ -127,9 +125,7 @@ func testPullRequestsClosedRecentSortType(t *testing.T) {
for _, test := range tests {
t.Run(test.sortType, func(t *testing.T) {
prs, _, err := issues_model.PullRequests(t.Context(), 1, &issues_model.PullRequestsOptions{
ListOptions: db.ListOptions{
Page: 1,
},
Page: 1,
State: "closed",
SortType: test.sortType,
})
@@ -172,9 +168,7 @@ func testLoadRequestedReviewers(t *testing.T) {
func testPullRequestsOldest(t *testing.T) {
prs, count, err := issues_model.PullRequests(t.Context(), 1, &issues_model.PullRequestsOptions{
ListOptions: db.ListOptions{
Page: 1,
},
Page: 1,
State: "open",
SortType: "oldest",
})