From 9cc5a629d290301c942898dabd9af80028d0a601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Tue, 9 Jul 2024 21:16:33 +0200 Subject: [PATCH] misc: Add golangci-lint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke Signed-off-by: Jan-Otto Kröpke --- .github/workflows/lint.yaml | 27 ++++++++++++++++++++++++ .golangci.yaml | 41 +++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/lint.yaml create mode 100644 .golangci.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..78cd2ca --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,27 @@ +name: golangci-lint +on: + push: + branches: + - main + - master + pull_request: + +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.59 + args: --issues-exit-code=0 \ No newline at end of file diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..15626fb --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,41 @@ +linters: + enable-all: true + disable: + - depguard + - exhaustruct + - gomnd + - funlen + - ireturn + - err113 + - execinquery + - mnd + - copyloopvar + - testpackage + - paralleltest + - musttag + - gochecknoglobals + - gosmopolitan + - varnamelen + - lll + +issues: + exclude: + - "dot-imports: should not use dot imports" + exclude-rules: + - path: _test\.go + linters: + - gocognit + - cyclop + - wrapcheck + - maintidx + - dogsled + - contextcheck + - dupword + - dupl + - funlen + - gocyclo + +linters-settings: + lll: + line-length: 160 +