Skip to content

Commit ff31e75

Browse files
ldeztraefiker
authored andcommitted
ci: reduce memory consumption of the linter
1 parent c87a37f commit ff31e75

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

.golangci.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[run]
22
deadline = "10m"
33
skip-files = []
4+
skip-dirs = [
5+
"pkg/provider/kubernetes/crd/generated/",
6+
]
47

58
[linters-settings]
69

@@ -40,9 +43,11 @@
4043
"scopelint",
4144
"gochecknoinits",
4245
"gochecknoglobals",
43-
# "godox", # manage TODO FIXME ## wait for https://github.com/golangci/golangci-lint/issues/337
46+
"godox",
47+
"gocognit",
4448
"bodyclose", # Too many false-positive and panics.
45-
# "stylecheck", # skip because report issues related to some generated files. ## wait for https://github.com/golangci/golangci-lint/issues/337
49+
"wsl", # Too strict
50+
"stylecheck", # skip because report issues related to some generated files.
4651
]
4752

4853
[issues]

build.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN mkdir -p /usr/local/bin \
1919
&& chmod +x /usr/local/bin/go-bindata
2020

2121
# Download golangci-lint binary to bin folder in $GOPATH
22-
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.18.0
22+
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.20.0
2323

2424
# Download golangci-lint and misspell binary to bin folder in $GOPATH
2525
RUN GO111MODULE=off go get github.com/client9/misspell/cmd/misspell

pkg/job/job_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ func TestJobBackOff(t *testing.T) {
3333
// Assert that the next backoff falls in the expected range.
3434
var minInterval = expected - time.Duration(testRandomizationFactor*float64(expected))
3535
var maxInterval = expected + time.Duration(testRandomizationFactor*float64(expected))
36+
3637
if i < 3 || i == 8 {
3738
time.Sleep(2 * time.Second)
3839
}
40+
3941
var actualInterval = exp.NextBackOff()
4042
if !(minInterval <= actualInterval && actualInterval <= maxInterval) {
4143
t.Error("error")
4244
}
43-
// assertEquals(t, expected, exp.currentInterval)
4445
}
4546
}

pkg/safe/routine_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
func TestNewPoolContext(t *testing.T) {
1414
type testKeyType string
15+
1516
testKey := testKeyType("test")
1617

1718
ctx := context.WithValue(context.Background(), testKey, "test")

pkg/tracing/tracing.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ func (t *Tracing) Extract(format interface{}, carrier interface{}) (opentracing.
9191

9292
// IsEnabled determines if tracing was successfully activated.
9393
func (t *Tracing) IsEnabled() bool {
94-
if t == nil || t.tracer == nil {
95-
return false
96-
}
97-
return true
94+
return t != nil && t.tracer != nil
9895
}
9996

10097
// Close tracer
@@ -169,9 +166,7 @@ func StartSpan(r *http.Request, operationName string, spanKind ext.SpanKindEnum,
169166
}
170167

171168
r = r.WithContext(ctx)
172-
return span, r, func() {
173-
span.Finish()
174-
}
169+
return span, r, func() { span.Finish() }
175170
}
176171

177172
// SetError flags the span associated with this request as in error.

0 commit comments

Comments
 (0)