File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 49
49
exit 1
50
50
fi
51
51
52
+ GOMOD_ERRORS=0
53
+
54
+ # Check go.mod files for correct dependency versions
55
+ while read -r mod_file; do
56
+ # Look for go-redis packages in require statements
57
+ while read -r pkg version; do
58
+ if [ " $version " != " ${TAG} " ]; then
59
+ printf " Error: %s has incorrect version for package %s: %s (expected %s)\n" " $mod_file " " $pkg " " $version " " ${TAG} "
60
+ GOMOD_ERRORS=$(( GOMOD_ERRORS + 1 ))
61
+ fi
62
+ done < <( awk ' /^require|^require \(/{p=1;next} /^\)/{p=0} p{if($1 ~ /^github\.com\/redis\/go-redis/){print $1, $2}}' " $mod_file " )
63
+ done < <( find . -type f -name ' go.mod' )
64
+
65
+ # Exit if there are gomod errors
66
+ if [ $GOMOD_ERRORS -gt 0 ]; then
67
+ exit 1
68
+ fi
69
+
70
+
52
71
PACKAGE_DIRS=$( find . -mindepth 2 -type f -name ' go.mod' -exec dirname {} \; \
53
72
| grep -E -v " example|internal" \
54
73
| sed ' s/^\.\///' \
You can’t perform that action at this time.
0 commit comments