github.com/jaylevin/jenkins-library@v1.230.4/.hooks/pre-commit (about)

     1  #!/bin/bash
     2  
     3  STAGED_GO_FILES=$(git diff --staged --name-only | grep "\.go$")
     4  
     5  if [[ "$STAGED_GO_FILES" = "" ]]; then
     6      exit 0
     7  fi
     8  
     9  echo "cleaning GO dependencies"
    10  go mod tidy
    11  git add go.mod go.sum