From 7571fdebcd0f1a3836334f73166aa06c191e3151 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Wed, 31 Jul 2024 11:52:59 -0700 Subject: [PATCH 1/2] upgrade golangci-lint, run pre-commit in CI, add more pre-commit hooks Signed-off-by: James Lamb --- .github/workflows/lint.yaml | 11 +++++++---- .pre-commit-config.yaml | 7 ++++++- CONTRIBUTING.md | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ac0ffb3..e28a0cf 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -4,13 +4,16 @@ jobs: lint: runs-on: ubuntu-latest steps: + - name: Checkout source + uses: actions/checkout@v4 + - name: Install Go uses: actions/setup-go@v5 with: go-version: 1.21.x - - name: Checkout source - uses: actions/checkout@v4 + # - name: Install Python + # uses: actions/setup-python@v3 - - name: golangci-lint - uses: golangci/golangci-lint-action@v4 + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b34a2a4..b251317 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,6 +2,11 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/golangci/golangci-lint - rev: v1.41.1 + rev: v1.59.1 hooks: - id: golangci-lint +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5b2d744..f7f8de7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,7 @@ PASS This project enforces linting with `golangci-lint`. You can use [pre-commit](https://pre-commit.com/) to check this automatically on commit, which will save time as you can catch linting errors before the CI does. ```console -$ pre-commit install +$ pre-commit install pre-commit installed at .git/hooks/pre-commit $ pre-commit run --all-files From 1158ccd9f6fe9b1b4f176d232a6751739fecaccd Mon Sep 17 00:00:00 2001 From: James Lamb Date: Wed, 31 Jul 2024 14:18:49 -0500 Subject: [PATCH 2/2] remove setup-python Signed-off-by: James Lamb --- .github/workflows/lint.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index e28a0cf..4f4d421 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -12,8 +12,5 @@ jobs: with: go-version: 1.21.x - # - name: Install Python - # uses: actions/setup-python@v3 - - name: Run pre-commit uses: pre-commit/action@v3.0.1