From 00a0f0e7c48de01edba01c1de8e0ad6eed2beae2 Mon Sep 17 00:00:00 2001 From: Sam Lown Date: Thu, 14 Nov 2024 12:12:59 +0000 Subject: [PATCH] Adding Go linter --- .github/workflows/lint.yaml | 27 +++++++++++++++++++++++++++ .golangci.yaml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 57 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..63a17b6 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,27 @@ +name: Lint +on: + push: + tags: + - v* + branches: + - main + pull_request: +jobs: + lint: + name: golangci-lint + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + id: go + + - name: Lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.58 diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..0151b98 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,30 @@ +run: + timeout: "120s" + +output: + formats: + - format: "colored-line-number" + +linters: + enable: + - "gocyclo" + - "unconvert" + - "goimports" + - "govet" + - "misspell" + - "nakedret" + - "revive" + - "goconst" + - "unparam" + - "gofmt" + - "errname" + - "zerologlint" + +linters-settings: + staticcheck: + # SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks + # Default: ["*"] + checks: ["all"] + +issues: + exclude-use-default: false