From dc0cc86d59adfeedb154fcb2334e17e0f06374bc Mon Sep 17 00:00:00 2001 From: Rebecca Mahany-Horton Date: Fri, 19 May 2023 11:18:09 -0400 Subject: [PATCH] Add golangci-lint job --- .github/workflows/golangci-lint.yml | 33 ++++++++++++++++++++++++ .golangci.yml | 39 +++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .golangci.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..6b083ef --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,33 @@ +name: golangci-lint + +on: + push: + branches: [main, master] + pull_request: + branches: '**' + +jobs: + golangci: + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + name: lint + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.20.4' + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + skip-pkg-cache: true + + # Run again as a workaround for https://github.com/golangci/golangci-lint-action/issues/362 + - name: golangci-lint + if: ${{ always() }} + run: golangci-lint run diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..8ac8a07 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,39 @@ +run: + skip-dirs: + - test-cmds + timeout: 5m + +linters: + enable: + - bodyclose + - unused + - gofmt + - govet + - misspell + - nakedret + - unconvert + - paralleltest + disable: + - errcheck + - gosec + - gosimple + - ineffassign + - interfacer + - maligned + - noctx + - staticcheck + - structcheck + - varcheck + +linters-settings: + errcheck: + ignore: github.com/go-kit/kit/log:Log + gofmt: + simplify: false + +issues: + exclude-rules: + # False positive: https://github.com/kunwardeep/paralleltest/issues/8. + - linters: + - paralleltest + text: "does not use range value in test Run"