diff --git a/README.md b/README.md index 5195f4b..ec7b48e 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000..3b260de --- /dev/null +++ b/lefthook.yml @@ -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/...