From 3b914fa73ea7867c8004efe046969a9b191c5b3c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 14 Apr 2025 18:09:19 +0200 Subject: [PATCH 1/2] add .gitattributes to force LF on Windows This prevents gofumpt showing false positives. Signed-off-by: Sebastiaan van Stijn --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4bb139d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.go -text diff=golang +*.go text eol=lf From 2fd3d09fab1246a4f9cecbdd3c9c136d7f8f341e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 12 Apr 2025 16:35:15 +0200 Subject: [PATCH 2/2] ci: add golangci-lint Signed-off-by: Sebastiaan van Stijn --- .github/workflows/test.yml | 6 ++++++ .golangci.yml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .golangci.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4120840..76acfc0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,12 @@ jobs: with: go-version: ${{ matrix.go-version }} + - name: lint + uses: golangci/golangci-lint-action@v7 + with: + version: v2.1 + args: --print-resources-usage --timeout=10m --verbose + - name: Test run: go test -v -cover "-coverprofile=coverage.txt" -covermode=atomic ./... shell: bash diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..21439e5 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,33 @@ +version: "2" + +issues: + # Disable maximum issues count per one linter. + max-issues-per-linter: 0 + # Disable maximum count of issues with the same text. + max-same-issues: 0 + +linters: + enable: + - errorlint + - unconvert + - unparam + exclusions: + generated: disable + presets: + - comments + - std-error-handling + settings: + staticcheck: + # Enable all options, with some exceptions. + # For defaults, see https://golangci-lint.run/usage/linters/#staticcheck + checks: + - all + - -QF1008 # Omit embedded fields from selector expression; https://staticcheck.dev/docs/checks/#QF1008 + - -ST1003 # Poorly chosen identifier; https://staticcheck.dev/docs/checks/#ST1003 + +formatters: + enable: + - gofumpt + - goimports + exclusions: + generated: disable