github.com/wtfutil/wtf@v0.43.0/scripts/check-uncommitted-vendor-files.sh (about)

     1  #!/bin/bash
     2  
     3  set -euo pipefail
     4  
     5  GOPROXY="https://proxy.golang.org,direct" GOSUMDB=off GO111MODULE=on go mod tidy
     6  
     7  untracked_files=$(git ls-files --others --exclude-standard | wc -l)
     8  
     9  diff_stat=$(git diff --shortstat)
    10  
    11  if [[ "${untracked_files}" -ne 0 || -n "${diff_stat}" ]]; then
    12    echo 'Untracked or diff in tracked vendor files found. Please run "go mod tidy" and commit the changes'
    13    exit 1
    14  fi