File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1068,6 +1068,13 @@ tasks:
1068
1068
vars :
1069
1069
targets : check-fmt
1070
1070
1071
+ - name : sa-modules
1072
+ tags : ["static-analysis"]
1073
+ commands :
1074
+ - func : run-make
1075
+ vars :
1076
+ targets : check-modules
1077
+
1071
1078
- name : sa-lint
1072
1079
tags : ["static-analysis"]
1073
1080
commands :
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ TEST_TIMEOUT = 1800
13
13
14
14
# ## Utility targets. ###
15
15
.PHONY : default
16
- default : add-license build build-examples check-env check-fmt lint test-short
16
+ default : add-license build build-examples check-env check-fmt check-modules lint test-short
17
17
18
18
.PHONY : add-license
19
19
add-license :
@@ -49,6 +49,20 @@ build-tests:
49
49
check-fmt :
50
50
etc/check_fmt.sh $(PKGS )
51
51
52
+ # check-modules runs "go mod tidy" then "go mod vendor" and exits with a non-zero exit code if there
53
+ # are any module or vendored modules changes. The intent is to confirm two properties:
54
+ #
55
+ # 1. Exactly the required modules are declared as dependencies. We should always be able to run
56
+ # "go mod tidy" and expect that no unrelated changes are made to the "go.mod" file.
57
+ #
58
+ # 2. All required modules are copied into the vendor/ directory and are an exact copy of the
59
+ # original module source code (i.e. the vendored modules are not modified from their original code).
60
+ .PHONY : check-modules
61
+ check-modules :
62
+ go mod tidy -v
63
+ go mod vendor
64
+ git diff --exit-code go.mod go.sum ./vendor
65
+
52
66
.PHONY : doc
53
67
doc :
54
68
godoc -http=:6060 -index
You can’t perform that action at this time.
0 commit comments