git hooks for Go projects
Go to file
2023-08-24 19:21:00 +02:00
general filepath love 2015-08-22 23:45:53 +02:00
githook-gobuild fix paths 2022-05-20 21:42:53 +02:00
githook-gofmt fix paths 2022-05-20 21:42:53 +02:00
githook-golangci-lint add cilint git hook 2023-08-24 19:18:46 +02:00
githook-gotest fix paths 2022-05-20 21:42:53 +02:00
.gitignore added binary 2015-08-01 00:29:50 +00:00
go.mod fix paths 2022-05-20 21:42:53 +02:00
go.sum fix paths 2022-05-20 21:42:53 +02:00
LICENSE Initial commit 2015-08-01 01:20:47 +02:00
main.go fix paths 2022-05-20 21:42:53 +02:00
README.md fix readme 2023-08-24 19:21:00 +02:00

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