From ca8d2785660ba51608352b15c9551015a3b1b89b Mon Sep 17 00:00:00 2001 From: novikovmu Date: Thu, 6 Oct 2022 15:13:33 +0300 Subject: [PATCH] MSP-1068 init golangci --- .golangci.yml | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..8a51202 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,69 @@ +run: + timeout: 2m + +linters: + disable-all: true + enable: + - asciicheck + - bodyclose + - deadcode + - dogsled + - errcheck + - funlen + - goconst + - gocritic + - gocyclo + - gofmt + - gomnd + - goprintffuncname + - gosimple + - govet + - nakedret + - nestif + - nolintlint + - prealloc + - rowserrcheck + - staticcheck + - structcheck + - typecheck + - unconvert + - unparam + - unused + - varcheck + - gosec + - misspell + - whitespace + - exhaustive #смотрит на соответствие между элементами enum и swich кейсами + - exportloopref #for _,p := []int{1, 2, 3} { s.Bar(&p) /* If s stores the pointer, it will be bug.*/ } + - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed. +linters-settings: + funlen: + lines: 80 + statements: 40 + prealloc: + # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. + # True by default. + simple: true + range-loops: true # Report preallocation suggestions on range loops, true by default + for-loops: true # Report preallocation suggestions on for loops, false by default + gocritic: + # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. + # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". + enabled-tags: + - diagnostic + - performance + disabled-checks: + - hugeParam + - rangeValCopy + - ifElseChain + exhaustive: + default-signifies-exhaustive: true + +issues: + exclude-rules: + - path: _test\.go # to exclude all test files for linter errcheck + linters: + - errcheck + - linters: + - gosec + text: "G101:"