From fbe9a0c726b2cbed0bacfa444a63be59397527b8 Mon Sep 17 00:00:00 2001 From: Jonny Stoten Date: Wed, 31 Jul 2024 14:42:19 +0100 Subject: [PATCH] Add linting github action (#107) * Add golangci config * Add lint action --- .github/workflows/lint.yml | 19 +++++++++++++++++++ .golangci.yaml | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 .golangci.yaml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..bb5003f --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,19 @@ +name: lint code +on: + pull_request: + workflow_dispatch: +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Set git to use LF + run: git config --global core.autocrlf false + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 1.22.x + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.59 + only-new-issues: true diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..3f413da --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,36 @@ +run: + timeout: 5m + go: "1.22" + +linters-settings: + gocritic: + enabled-tags: + - performance + lll: + line-length: 200 + + misspell: + locale: US + +linters: + disable-all: true + enable: + - errcheck + - forcetypeassert + - gocritic + - goconst + - godot + - gofmt + - gofumpt + - goimports + - gosec + - gosimple + - govet + - importas + - ineffassign + - misspell + - revive # replacement for golint + - staticcheck + - typecheck + - unused + - whitespace