git hooks for Go projects
Go to file
Ingo Oeser 8b627dab53 empty filenames don't have a suffix
so elide that condition. Even the small speed win is marginal,
since we just called exec before, which is way more expensive.
2015-08-22 22:59:27 +02:00
general empty filenames don't have a suffix 2015-08-22 22:59:27 +02:00
githook-gobuild [gobuild] initial hook to check the build 2015-07-31 23:53:25 +00:00
githook-gofmt [main] show only files that don't match gofmt 2015-08-01 01:16:05 +00:00
githook-gotest [gotest] new hook for go test and added binary to gitignore 2015-07-31 23:58:20 +00:00
.gitignore added binary 2015-08-01 00:29:50 +00:00
LICENSE Initial commit 2015-08-01 01:20:47 +02:00 removed space at end of line (copy & paste is now possible ;)) 2015-08-05 09:32:58 +00:00
main.go [main] fixed some directory hazzle 2015-08-01 01:16:17 +00:00


Collection of git hooks. Most of the pre-commit hooks are Go specific.


  • to install the hooks use:

    go get
    go get
    go get
    go get
  • on a Unix based system symlink it with

    ( cd .git/hooks && \
      ln -s $GOPATH/bin/git-gohooks pre-commit && \
      ln -s $GOPATH/bin/githook-gofmt pre-commit_01_gofmt && \
      ln -s $GOPATH/bin/githook-gobuild pre-commit_02_gobuild && \
      ln -s $GOPATH/bin/githook-gotest pre-commit_03_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_gofmt.exe <YourGoPath>\bin\githook-gofmt.exe
    mklink /H pre-commit_02_gobuild.exe <YourGoPath>\bin\githook-gobuild.exe
    mklink /H pre-commit_03_gotest.exe <YourGoPath>\bin\githook-gotest.exe