diff --git a/.golangci.yml b/.golangci.yml index d3c2034..c90a028 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,8 @@ linters-settings: govet: - check-shadowing: true + shadow: true golint: - min-confidence: 0 + min-confidence: 0.6 gocyclo: min-complexity: 15 maligned: @@ -24,48 +24,80 @@ linters-settings: disabled-checks: - wrapperFunc - hugeParam + - rangeValCopy linters: + disable-all: true enable: - - megacheck - revive - govet - unconvert - - megacheck - - gas - - gocyclo - - dupl - - misspell + - gosec - unparam - unused - typecheck - ineffassign - stylecheck - gochecknoinits - - exportloopref - gocritic - nakedret - gosimple - prealloc + fast: false - disable-all: true + run: - output: - format: tab - skip-dirs: - - vendor + concurrency: 4 issues: + exclude-dirs: + - vendor exclude-rules: - text: "should have a package comment, unless it's in another file for this package" linters: - golint + - text: "exitAfterDefer:" + linters: + - gocritic + - text: "whyNoLint: include an explanation for nolint directive" + linters: + - gocritic + - text: "go.mongodb.org/mongo-driver/bson/primitive.E" + linters: + - govet + - text: "weak cryptographic primitive" + linters: + - gosec + - text: "integer overflow conversion" + linters: + - gosec + - text: "should have a package comment" + linters: + - revive - text: "at least one file in a package should have a package comment" linters: - stylecheck - - text: "package-comments: should have a package comment" + - text: "commentedOutCode: may want to remove commented-out code" + linters: + - gocritic + - text: "unnamedResult: consider giving a name to these results" + linters: + - gocritic + - text: "var-naming: don't use an underscore in package name" linters: - revive - + - text: "should not use underscores in package names" + linters: + - stylecheck + - text: "struct literal uses unkeyed fields" + linters: + - govet + - linters: + - unparam + - unused + - revive + path: _test\.go$ + text: "unused-parameter" exclude-use-default: false + diff --git a/middleware/concurrent.go b/middleware/concurrent.go index 953180f..e7ee540 100644 --- a/middleware/concurrent.go +++ b/middleware/concurrent.go @@ -5,8 +5,8 @@ import ( ) // MaxConcurrent middleware limits the total concurrency for a given requester -func MaxConcurrent(max int) func(http.RoundTripper) http.RoundTripper { - sema := make(chan struct{}, max) +func MaxConcurrent(maxLimit int) func(http.RoundTripper) http.RoundTripper { + sema := make(chan struct{}, maxLimit) return func(next http.RoundTripper) http.RoundTripper { fn := func(req *http.Request) (*http.Response, error) { sema <- struct{}{}