From c394846f20d15b6d3b9924ded533979b6903a89c Mon Sep 17 00:00:00 2001 From: appleboy Date: Fri, 27 Sep 2024 23:30:19 +0800 Subject: [PATCH] ci: configure and enable GolangCI linters - Add `.golangci.yml` configuration file - Enable specific linters including `bodyclose`, `errcheck`, `gofmt`, `govet`, and others - Exclude certain linters for specific test files like `authenticator_test.go`, `parser_test.go`, and `signatureheader_test.go` - Set the linter run timeout to 3 minutes Signed-off-by: appleboy --- .golangci.yml | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..3ddcefe --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,51 @@ +linters: + enable-all: false + disable-all: true + fast: false + enable: + - bodyclose + - dogsled + - dupl + - errcheck + - exportloopref + - exhaustive + - gochecknoinits + - goconst + - gocritic + - gocyclo + - gofmt + - goimports + - goprintffuncname + - gosec + - gosimple + - govet + - ineffassign + - lll + - misspell + - nakedret + - noctx + - nolintlint + - rowserrcheck + - staticcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + - whitespace + - gofumpt + +issues: + exclude-rules: + - path: authenticator_test.go + linters: + - bodyclose + - unparam + - path: parser_test.go + linters: + - lll + - path: signatureheader_test.go + linters: + - lll +run: + timeout: 3m