ci: reduce memory consumption of the linter

This commit is contained in:
Ludovic Fernandez 2019-10-09 11:48:04 +02:00 committed by Traefiker Bot
parent c87a37f804
commit ff31e75ccc
5 changed files with 13 additions and 11 deletions

View file

@ -1,6 +1,9 @@
[run] [run]
deadline = "10m" deadline = "10m"
skip-files = [] skip-files = []
skip-dirs = [
"pkg/provider/kubernetes/crd/generated/",
]
[linters-settings] [linters-settings]
@ -40,9 +43,11 @@
"scopelint", "scopelint",
"gochecknoinits", "gochecknoinits",
"gochecknoglobals", "gochecknoglobals",
# "godox", # manage TODO FIXME ## wait for https://github.com/golangci/golangci-lint/issues/337 "godox",
"gocognit",
"bodyclose", # Too many false-positive and panics. "bodyclose", # Too many false-positive and panics.
# "stylecheck", # skip because report issues related to some generated files. ## wait for https://github.com/golangci/golangci-lint/issues/337 "wsl", # Too strict
"stylecheck", # skip because report issues related to some generated files.
] ]
[issues] [issues]

View file

@ -19,7 +19,7 @@ RUN mkdir -p /usr/local/bin \
&& chmod +x /usr/local/bin/go-bindata && chmod +x /usr/local/bin/go-bindata
# Download golangci-lint binary to bin folder in $GOPATH # Download golangci-lint binary to bin folder in $GOPATH
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.18.0 RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.20.0
# Download golangci-lint and misspell binary to bin folder in $GOPATH # Download golangci-lint and misspell binary to bin folder in $GOPATH
RUN GO111MODULE=off go get github.com/client9/misspell/cmd/misspell RUN GO111MODULE=off go get github.com/client9/misspell/cmd/misspell

View file

@ -33,13 +33,14 @@ func TestJobBackOff(t *testing.T) {
// Assert that the next backoff falls in the expected range. // Assert that the next backoff falls in the expected range.
var minInterval = expected - time.Duration(testRandomizationFactor*float64(expected)) var minInterval = expected - time.Duration(testRandomizationFactor*float64(expected))
var maxInterval = expected + time.Duration(testRandomizationFactor*float64(expected)) var maxInterval = expected + time.Duration(testRandomizationFactor*float64(expected))
if i < 3 || i == 8 { if i < 3 || i == 8 {
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
} }
var actualInterval = exp.NextBackOff() var actualInterval = exp.NextBackOff()
if !(minInterval <= actualInterval && actualInterval <= maxInterval) { if !(minInterval <= actualInterval && actualInterval <= maxInterval) {
t.Error("error") t.Error("error")
} }
// assertEquals(t, expected, exp.currentInterval)
} }
} }

View file

@ -12,6 +12,7 @@ import (
func TestNewPoolContext(t *testing.T) { func TestNewPoolContext(t *testing.T) {
type testKeyType string type testKeyType string
testKey := testKeyType("test") testKey := testKeyType("test")
ctx := context.WithValue(context.Background(), testKey, "test") ctx := context.WithValue(context.Background(), testKey, "test")

View file

@ -91,10 +91,7 @@ func (t *Tracing) Extract(format interface{}, carrier interface{}) (opentracing.
// IsEnabled determines if tracing was successfully activated. // IsEnabled determines if tracing was successfully activated.
func (t *Tracing) IsEnabled() bool { func (t *Tracing) IsEnabled() bool {
if t == nil || t.tracer == nil { return t != nil && t.tracer != nil
return false
}
return true
} }
// Close tracer // Close tracer
@ -169,9 +166,7 @@ func StartSpan(r *http.Request, operationName string, spanKind ext.SpanKindEnum,
} }
r = r.WithContext(ctx) r = r.WithContext(ctx)
return span, r, func() { return span, r, func() { span.Finish() }
span.Finish()
}
} }
// SetError flags the span associated with this request as in error. // SetError flags the span associated with this request as in error.