📦 build: add lefthook pre-commit hooks matching CI checks

This commit is contained in:
2026-07-13 23:15:50 +07:00
parent e29c6e1dfa
commit cfca7971e0
2 changed files with 32 additions and 1 deletions
+17 -1
View File
@@ -86,6 +86,22 @@ go build -o trollssh ./src
./trollssh
```
CI runs the following checks on every push:
```sh
gofmt -l ./src # format
go vet ./src/... # vet
golangci-lint run ./src/... # lint, see https://golangci-lint.run
go test ./src/... # tests
```
To run them automatically before each commit, install
[lefthook](https://github.com/evilmartians/lefthook) and `golangci-lint`, then:
```sh
lefthook install
```
## License
See [LICENSE](LICENSE)
[MIT](LICENSE)
+15
View File
@@ -0,0 +1,15 @@
pre-commit:
parallel: true
commands:
format:
glob: "*.go"
run: test -z "$(gofmt -l {staged_files})"
vet:
glob: "*.go"
run: go vet ./src/...
lint:
glob: "*.go"
run: golangci-lint run ./src/...
test:
glob: "*.go"
run: go test ./src/...