File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,17 @@ source "${SCRIPTDIR}/.validate"
88tidy_files=(' go.mod' ' go.sum' )
99vendor_files=(" ${tidy_files[@]} " ' vendor/' )
1010
11+ validate_vendor_files_exist () {
12+ local file
13+ for file in " ${vendor_files[@]} " ; do
14+ if [ ! -e " $file " ]; then
15+ echo >&2 " ERROR: required file '$file ' does not exist"
16+ return 1
17+ fi
18+ done
19+ return 0
20+ }
21+
1122validate_vendor_tidy () {
1223 # run mod tidy
1324 ./hack/vendor.sh tidy
@@ -37,6 +48,16 @@ validate_vendor_license() {
3748 done < <( awk ' /^# /{ print $2 }' vendor/modules.txt)
3849}
3950
51+ # First check the required files exist as git diff will not report missing files.
52+ if ! validate_vendor_files_exist; then
53+ {
54+ echo ' FAIL: Vendoring was not performed correctly!'
55+ echo
56+ echo ' Please revendor with hack/vendor.sh'
57+ } >&2
58+ exit 1
59+ fi
60+
4061if validate_vendor_tidy && validate_vendor_diff && validate_vendor_license; then
4162 echo >&2 ' PASS: Vendoring has been performed correctly!'
4263else
You can’t perform that action at this time.
0 commit comments