Skip to content

Commit 8a01fdd

Browse files
committed
Lint fixes
1 parent 1feb423 commit 8a01fdd

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

models/issues/issue_search.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ func applyLabelsCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.Session
144144
// ... and use them in a subquery of the form :
145145
// where (select count(*) from issue_label where issue_id=issue.id and label_id in (2, 4, 6)) = 3
146146
// This equality is garanteed thanks to unique index (issue_id,label_id) on table issue_label.
147-
if (len(IncludedLabelIDs) > 0) {
147+
if len(IncludedLabelIDs) > 0 {
148148
subquery := builder.Select("count(*)").From("issue_label").Where(builder.Expr("issue_id = issue.id")).
149149
And(builder.In("label_id", IncludedLabelIDs.Values()))
150150
sess.Where(builder.Eq{strconv.Itoa(len(IncludedLabelIDs)): subquery})
151151
}
152152
// or (select count(*)...) = 0 for excluded labels
153-
if (len(ExcludedLabelIDs) > 0) {
153+
if len(ExcludedLabelIDs) > 0 {
154154
subquery := builder.Select("count(*)").From("issue_label").Where(builder.Expr("issue_id = issue.id")).
155155
And(builder.In("label_id", ExcludedLabelIDs.Values()))
156156
sess.Where(builder.Eq{"0": subquery})

models/issues/label.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func (l *Label) LoadSelectedLabelsAfterClick(currentSelectedLabels []int64, curr
151151
// sort the ids to avoid the crawlers hitting the same
152152
// page with a different order of parameters
153153
// (still no sort.Ints64 in Go 1.20... Maybe Slice.sort in Go 1.21 ?)
154-
sort.Slice(labelQuerySlice, func (i, j int) bool { return labelQuerySlice[i] < labelQuerySlice[j] })
154+
sort.Slice(labelQuerySlice, func(i, j int) bool { return labelQuerySlice[i] < labelQuerySlice[j] })
155155
// Deduplicate using a container
156156
// (maybe again, with Go 1.21 and Slice.compact() ?)
157157
labelQueryContainer := make(container.Set[string])

models/issues/label_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestLabel_LoadSelectedLabelsAfterClick(t *testing.T) {
3636
label.LoadSelectedLabelsAfterClick([]int64{1, 7, 1, 7, 7}, []string{"", "scope", "", "scope", "scope"})
3737
// As of now, LoadSelectedLabelsAfterClick() use a map to deduplicate, which
3838
// doesn't garanty the order
39-
assert.Equal(t, true, "1,8" == label.QueryString || "8,1" == label.QueryString, "unexpected value '%s' (expected '1,8' or '8,1')", label.QueryString)
39+
assert.Equal(t, true, label.QueryString == "1,8" || label.QueryString == "8,1", "unexpected value '%s' (expected '1,8' or '8,1')", label.QueryString)
4040
assert.Equal(t, false, label.IsSelected)
4141

4242
// Third test : empty set

0 commit comments

Comments
 (0)