mirror of
https://github.com/YuzuZensai/TrollSSH.git
synced 2026-09-13 16:39:06 +00:00
📦 build: add lefthook pre-commit hooks matching CI checks
This commit is contained in:
@@ -86,6 +86,22 @@ go build -o trollssh ./src
|
|||||||
./trollssh
|
./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
|
## License
|
||||||
|
|
||||||
See [LICENSE](LICENSE)
|
[MIT](LICENSE)
|
||||||
|
|||||||
@@ -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/...
|
||||||
Reference in New Issue
Block a user