From e20f7efc2dad2945b987ca7f287a59f481f11ddd Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Sun, 4 Aug 2024 11:56:08 +0100 Subject: [PATCH] fix golangci-lint reported errors, update configuration --- .golangci.yml | 27 +++++++-------------------- benchmarks.go | 4 ++-- logger/options.go | 6 +++--- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 010de12..bb57842 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,12 +1,9 @@ linters-settings: govet: - check-shadowing: true - golint: - min-confidence: 0 + enable: + - shadow gocyclo: min-complexity: 15 - maligned: - suggest-new: true dupl: threshold: 100 goconst: @@ -26,17 +23,17 @@ linters-settings: linters: enable: - - megacheck + - staticcheck + - gosimple - revive - govet - unconvert - - megacheck - - gas + - unused + - gosec - gocyclo - dupl - misspell - unparam - - unused - typecheck - ineffassign - stylecheck @@ -44,26 +41,16 @@ linters: - exportloopref - gocritic - nakedret - - gosimple - prealloc fast: false disable-all: true -run: - output: - format: tab - skip-dirs: - - vendor - issues: exclude-rules: - text: 'Deferring unsafe method "Close" on type "io.ReadCloser"' linters: - gosec - - text: "should have a package comment, unless it's in another file for this package" - linters: - - golint - path: _test\.go linters: - dupl - exclude-use-default: false + exclude-use-default: false \ No newline at end of file diff --git a/benchmarks.go b/benchmarks.go index 702e517..96deb32 100644 --- a/benchmarks.go +++ b/benchmarks.go @@ -55,10 +55,10 @@ func NewBenchmarks() *Benchmarks { // Default is 15 minutes. The increase of this range will change memory utilization as each second of the range // kept as benchData aggregate. The default means 15*60 = 900 seconds of data aggregate. // Larger range allows for longer time periods to be benchmarked. -func (b *Benchmarks) WithTimeRange(max time.Duration) *Benchmarks { +func (b *Benchmarks) WithTimeRange(maximum time.Duration) *Benchmarks { b.lock.Lock() defer b.lock.Unlock() - b.maxTimeRange = max + b.maxTimeRange = maximum return b } diff --git a/logger/options.go b/logger/options.go index 24f99de..b0e4199 100644 --- a/logger/options.go +++ b/logger/options.go @@ -13,10 +13,10 @@ func WithBody(l *Middleware) { } // MaxBodySize sets size of the logged part of the request body. -func MaxBodySize(max int) Option { +func MaxBodySize(maximum int) Option { return func(l *Middleware) { - if max >= 0 { - l.maxBodySize = max + if maximum >= 0 { + l.maxBodySize = maximum } } }