Skip to content

Commit c7351f9

Browse files
committed
ci/lint: fixed several issues following golangci-lint update
1 parent 743310c commit c7351f9

11 files changed

Lines changed: 42 additions & 71 deletions

File tree

.golangci.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
linters:
22
enable-all: true
33
disable:
4-
# Deprecated ones
5-
- golint
6-
- ifshort
7-
- interfacer
8-
- maligned
9-
- nosnakecase
10-
- scopelint
4+
# Deprecated
5+
- gomnd
116

127
# We don't want these ones
13-
- exhaustivestruct
148
- forcetypeassert
159
- gochecknoglobals
1610
- godox
17-
- goerr113
1811
- ireturn
1912
- nakedret
2013
- testpackage
2114
- varnamelen
2215
- interfacebloat
16+
- wsl
2317

2418
# TODO
2519
- tagliatelle
@@ -29,7 +23,7 @@ linters:
2923
- gomoddirectives
3024
- forbidigo
3125
- goconst
32-
- gomnd
26+
- mnd
3327
- lll
3428
- dupl
3529
- depguard

.revive.toml

Lines changed: 0 additions & 31 deletions
This file was deleted.

pkg/controller/environments.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ func (c *Controller) PullEnvironmentMetrics(ctx context.Context, env schemas.Env
130130
if err = c.Store.GetMetric(ctx, &behindCommitsCountMetric); err != nil {
131131
return err
132132
}
133+
133134
envBehindCommitCount = behindCommitsCountMetric.Value
134135
}
135136
}

pkg/controller/jobs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ func (c *Controller) ProcessJobMetrics(ctx context.Context, ref schemas.Ref, job
161161

162162
if jobRunCountExists && ((lastJob.ID != job.ID && jobTriggered) || (lastJob.ID == job.ID && jobTriggered && !lastJobTriggered)) {
163163
storeGetMetric(ctx, c.Store, &jobRunCount)
164+
164165
jobRunCount.Value++
165166
}
166167

pkg/controller/metrics.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ func emitStatusMetric(ctx context.Context, s store.Store, metricKind schemas.Met
230230

231231
continue
232232
}
233+
233234
statusMetric.Value = 0
234235
}
235236

pkg/gitlab/branches_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ func TestGetProjectBranches(t *testing.T) {
2121
assert.Equal(t, []string{"100"}, r.URL.Query()["per_page"])
2222
currentPage, err := strconv.Atoi(r.URL.Query()["page"][0])
2323
assert.NoError(t, err)
24+
2425
nextPage := currentPage + 1
26+
2527
if currentPage == 2 {
2628
nextPage = currentPage
2729
}

pkg/gitlab/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (c *Client) ReadinessCheck(ctx context.Context) healthcheck.Check {
126126
return fmt.Errorf("HTTP error: empty response")
127127
}
128128

129-
if err == nil && resp.StatusCode != 200 {
129+
if err == nil && resp.StatusCode != http.StatusOK {
130130
return fmt.Errorf("HTTP error: %d", resp.StatusCode)
131131
}
132132

pkg/monitor/ui/ui.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,14 @@ func (m *model) View() string {
287287
// TABS
288288
{
289289
renderedTabs := []string{}
290+
290291
for tabID, t := range tabs {
291292
if m.tabID == tabID {
292293
renderedTabs = append(renderedTabs, activeTab.Render(string(t)))
293294

294295
continue
295296
}
297+
296298
renderedTabs = append(renderedTabs, inactiveTab.Render(string(t)))
297299
}
298300

pkg/ratelimit/ratelimit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
// Limiter ..
99
type Limiter interface {
10-
Take(context.Context) time.Duration
10+
Take(ctx context.Context) time.Duration
1111
}
1212

1313
// Take ..

pkg/store/local.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ func (l *Local) UnqueueTask(_ context.Context, tt schemas.TaskType, uniqueID str
331331
defer l.tasksMutex.Unlock()
332332

333333
delete(l.tasks[tt], uniqueID)
334+
334335
l.executedTasksCount++
335336
}
336337

0 commit comments

Comments
 (0)