git-gohooks/README.md
2023-08-24 19:21:00 +02:00

36 lines
1.3 KiB
Markdown

git-hooks
=========
Collection of git hooks. Most of the pre-commit hooks are Go specific.
usage
-----
* to install the hooks use:
go install git.mthie.com/mthie/git-gohooks@latest
go install git.mthie.com/mthie/git-gohooks/githook-golangci-lint@latest
go install git.mthie.com/mthie/git-gohooks/githook-gobuild@latest
go install git.mthie.com/mthie/git-gohooks/githook-gofmt@latest
go install git.mthie.com/mthie/git-gohooks/githook-gotest@latest
* on a Unix based system symlink it with
( cd .git/hooks && \
ln -s $GOPATH/bin/git-gohooks pre-commit && \
ln -s $GOPATH/bin/githook-golangci-lint pre-commit_01_golangci_lint && \
ln -s $GOPATH/bin/githook-gofmt pre-commit_02_gofmt && \
ln -s $GOPATH/bin/githook-gobuild pre-commit_03_gobuild && \
ln -s $GOPATH/bin/githook-gotest pre-commit_04_gotest )
* on a Windows system in a command shell with **Administrator privileges**
cd .git\hooks
mklink /H pre-commit <YourGoPath>\bin\git-gohooks.exe
mklink /H pre-commit_01_golangci_lint.exe <YourGoPath>\bin\githook-golangci-lint.exe
mklink /H pre-commit_02_gofmt.exe <YourGoPath>\bin\githook-gofmt.exe
mklink /H pre-commit_03_gobuild.exe <YourGoPath>\bin\githook-gobuild.exe
mklink /H pre-commit_04_gotest.exe <YourGoPath>\bin\githook-gotest.exe