From 5b938091d705e01f6467cdd6be9144e491c66502 Mon Sep 17 00:00:00 2001 From: "Marcel S. Henselin" Date: Fri, 17 Apr 2026 16:09:15 +0200 Subject: [PATCH] feat: linting --- .github/workflows/release.yml | 20 +++++--- .golang-ci.yaml | 90 +++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 .golang-ci.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9f9d33..7d35a7e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,11 +16,16 @@ jobs: lint: runs-on: stackit-docker steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - name: CI checkout + uses: actions/checkout@v6 + + - name: Setup GO + uses: actions/setup-go@v6 with: go-version: 1.26 - - uses: golangci/golangci-lint-action@v3 + + - name: GO Linting + uses: golangci/golangci-lint-action@v3 # build: # runs-on: stackit-docker @@ -40,9 +45,11 @@ jobs: runs-on: stackit-docker # needs: build steps: - - uses: actions/checkout@v6 + - name: Checkout code + uses: actions/checkout@v6 - - uses: go-semantic-release/action@v1 + - name: Semantic Release + uses: go-semantic-release/action@v1 id: semrel with: github-token: ${{ env.FORGEJO_TOKEN }} @@ -51,8 +58,7 @@ jobs: changelog-file: CHANGELOG.md changelog-generator-opt: "emojis=true" - - - name: Login to Docker Hub + - name: Login to Docker Hub if: steps.semrel.outputs.version != '' uses: docker/login-action@v4 with: diff --git a/.golang-ci.yaml b/.golang-ci.yaml new file mode 100644 index 0000000..b5d12d0 --- /dev/null +++ b/.golang-ci.yaml @@ -0,0 +1,90 @@ +version: "2" +run: + concurrency: 4 +output: + formats: + text: + print-linter-name: true + print-issued-lines: true + colors: true + path: stdout +linters: + enable: + - bodyclose + - depguard + - errorlint + - forcetypeassert + - gochecknoinits + - gocritic + - gosec + - misspell + - nakedret + - revive + - sqlclosecheck + - wastedassign + disable: + - noctx + - unparam + settings: + depguard: + rules: + main: + list-mode: original + allow: [] + deny: + - pkg: github.com/stretchr/testify + desc: Do not use a testing framework + gocritic: + disabled-checks: + - wrapperFunc + - typeDefFirst + - ifElseChain + - dupImport + - hugeParam + enabled-tags: + - performance + - style + - experimental + gosec: + excludes: + - G104 + - G102 + - G304 + - G307 + misspell: + locale: US + nakedret: + max-func-lines: 0 + revive: + severity: error + rules: + - name: errorf + - name: context-as-argument + - name: error-return + - name: increment-decrement + - name: indent-error-flow + - name: superfluous-else + - name: unused-parameter + - name: unreachable-code + - name: atomic + - name: empty-lines + - name: early-return + exclusions: + paths: + - generator/ + - internal/testutils + generated: lax + warn-unused: true + # Excluding configuration per-path, per-linter, per-text and per-source. + rules: + # Exclude some linters from running on tests files. + - path: _test\.go + linters: + - gochecknoinits +formatters: + enable: + - gofmt + - goimports +# settings: +# goimports: +# local-prefixes: