github.com/unigraph-dev/dgraph@v1.1.1-0.20200923154953-8b52b426f765/contrib/hooks/README.md (about)

     1  # Git hooks
     2  
     3  * The pre-push hook runs tests before pushing.
     4  
     5  * The pre-commit hook checks for go vet and golint errors for the staged files whose content was changed.
     6  
     7  * I took inspiration for golint.sh and govet.sh from https://github.com/youtube/vitess/tree/master/misc/git/hooks.
     8  
     9  ## The files in this folder can be symlinked to those in .git/hooks using the following commands.
    10  
    11  ```
    12  # from the root of the repo, move into the git folder.
    13  $ cd .git
    14  # delete the hooks folder which is already there.
    15  $ rm -rf hooks
    16  # create symlink between directories
    17  $ ln -s ../contrib/hooks hooks
    18  ```
    19  
    20  Now everytime you do a `git push`, tests should be run for you.
    21  And before a commit, you'd have the option to see results from and golint.
    22  Also, if go vet shows any errors you won't be allowed to commit without correcting them.