Skip to content

Fix remaining issues after gopls modernize formatting #34771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions modules/actions/workflows.go
Original file line number Diff line number Diff line change
@@ -565,18 +565,12 @@ func matchPullRequestReviewEvent(prPayload *api.PullRequestPayload, evt *jobpars
actions = append(actions, "submitted", "edited")
}

matched := false
for _, val := range vals {
if slices.ContainsFunc(actions, glob.MustCompile(val, '/').Match) {
matched = true
}
if matched {
matchTimes++
break
}
}
if matched {
matchTimes++
}
default:
log.Warn("pull request review event unsupported condition %q", cond)
}
@@ -611,18 +605,12 @@ func matchPullRequestReviewCommentEvent(prPayload *api.PullRequestPayload, evt *
actions = append(actions, "created", "edited")
}

matched := false
for _, val := range vals {
if slices.ContainsFunc(actions, glob.MustCompile(val, '/').Match) {
matched = true
}
if matched {
matchTimes++
break
}
}
if matched {
matchTimes++
}
default:
log.Warn("pull request review comment event unsupported condition %q", cond)
}
2 changes: 1 addition & 1 deletion modules/setting/markup.go
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ func loadMarkupFrom(rootCfg ConfigProvider) {
func newMarkupSanitizer(name string, sec ConfigSection) {
rule, ok := createMarkupSanitizerRule(name, sec)
if ok {
if after, ok0 := strings.CutPrefix(name, "sanitizer."); ok0 {
if after, found := strings.CutPrefix(name, "sanitizer."); found {
names := strings.SplitN(after, ".", 2)
name = names[0]
}
6 changes: 1 addition & 5 deletions routers/install/install.go
Original file line number Diff line number Diff line change
@@ -99,11 +99,7 @@ func Install(ctx *context.Context) {
form.SSLMode = setting.Database.SSLMode

curDBType := setting.Database.Type.String()
var isCurDBTypeSupported bool
if slices.Contains(setting.SupportedDatabaseTypes, curDBType) {
isCurDBTypeSupported = true
}
if !isCurDBTypeSupported {
if !slices.Contains(setting.SupportedDatabaseTypes, curDBType) {
curDBType = "mysql"
}
ctx.Data["CurDbType"] = curDBType
6 changes: 1 addition & 5 deletions routers/web/explore/code.go
Original file line number Diff line number Diff line change
@@ -94,11 +94,7 @@ func Code(ctx *context.Context) {

loadRepoIDs := make([]int64, 0, len(searchResults))
for _, result := range searchResults {
var find bool
if slices.Contains(loadRepoIDs, result.RepoID) {
find = true
}
if !find {
if !slices.Contains(loadRepoIDs, result.RepoID) {
loadRepoIDs = append(loadRepoIDs, result.RepoID)
}
}
6 changes: 1 addition & 5 deletions routers/web/user/code.go
Original file line number Diff line number Diff line change
@@ -87,11 +87,7 @@ func CodeSearch(ctx *context.Context) {

loadRepoIDs := make([]int64, 0, len(searchResults))
for _, result := range searchResults {
var find bool
if slices.Contains(loadRepoIDs, result.RepoID) {
find = true
}
if !find {
if !slices.Contains(loadRepoIDs, result.RepoID) {
loadRepoIDs = append(loadRepoIDs, result.RepoID)
}
}
8 changes: 2 additions & 6 deletions tests/integration/api_issue_test.go
Original file line number Diff line number Diff line change
@@ -267,9 +267,7 @@ func TestAPISearchIssues(t *testing.T) {
defer tests.PrepareTestEnv(t)()

// as this API was used in the frontend, it uses UI page size
expectedIssueCount := min(
// from the fixtures
20, setting.UI.IssuePagingNum)
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures

link, _ := url.Parse("/api/v1/repos/issues/search")
token := getUserToken(t, "user1", auth_model.AccessTokenScopeReadIssue)
@@ -370,9 +368,7 @@ func TestAPISearchIssuesWithLabels(t *testing.T) {
defer tests.PrepareTestEnv(t)()

// as this API was used in the frontend, it uses UI page size
expectedIssueCount := min(
// from the fixtures
20, setting.UI.IssuePagingNum)
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures

link, _ := url.Parse("/api/v1/repos/issues/search")
token := getUserToken(t, "user1", auth_model.AccessTokenScopeReadIssue)
8 changes: 2 additions & 6 deletions tests/integration/issue_test.go
Original file line number Diff line number Diff line change
@@ -488,9 +488,7 @@ func TestSearchIssues(t *testing.T) {

session := loginUser(t, "user2")

expectedIssueCount := min(
// from the fixtures
20, setting.UI.IssuePagingNum)
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures

link, _ := url.Parse("/issues/search")
req := NewRequest(t, "GET", link.String())
@@ -581,9 +579,7 @@ func TestSearchIssues(t *testing.T) {
func TestSearchIssuesWithLabels(t *testing.T) {
defer tests.PrepareTestEnv(t)()

expectedIssueCount := min(
// from the fixtures
20, setting.UI.IssuePagingNum)
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures

session := loginUser(t, "user1")
link, _ := url.Parse("/issues/search")