Skip to content

Commit

Permalink
Run local linter with charon's linting config
Browse files Browse the repository at this point in the history
  • Loading branch information
KaloyanTanev committed Jul 21, 2024
1 parent 7641c62 commit 0315c6d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ repos:

# Then run code validators (on the formatted code)

- repo: https://github.com/golangci/golangci-lint # See .golangci.yml for config
rev: v1.59.1
hooks:
- id: golangci-lint

- repo: local
hooks:
- id: golangci-lint
name: golangci-lint
language: script
entry: .pre-commit/run_linter.sh
types: [ file, go ]
- id: run-go-tests
name: run-go-tests
language: script
Expand Down
18 changes: 18 additions & 0 deletions .pre-commit/run_linter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

VERSION="1.59.1"

if ! command -v golangci-lint &> /dev/null
then
echo "golangci-lint could not be found"
exit 1
fi

version_check=$(golangci-lint version)
if [[ $version_check != *"$VERSION"* ]]; then
echo $version_check
echo "golangci-lint version is not $VERSION"
exit 1
fi

golangci-lint run

0 comments on commit 0315c6d

Please sign in to comment.