Skip to content

Commit e138593

Browse files
committed
Add script to verify dependencies
1 parent ef98b96 commit e138593

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,15 @@ clean:
281281
rm -rf output/
282282
rm -f coverage.out
283283

284-
depup:
285-
go get $(shell go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -mod=mod -m all)
284+
.PHONY: gomod
285+
gomod:
286286
go mod tidy
287287
go mod vendor
288288
cd test; go mod tidy
289+
290+
.PHONY: goget
291+
goget:
292+
go get $(shell go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -mod=mod -m all)
293+
294+
.PHONY: depup
295+
depup: goget gomod

hack/verify-gomod.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Copyright 2024 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
make gomod
22+
changes=$(git status --porcelain go.mod go.sum vendor/ tests/e2e/go.mod tests/e2e/go.sum || true)
23+
if [ -n "${changes}" ]; then
24+
echo "ERROR: go modules are not up to date; please run: make gomod"
25+
echo "changed files:"
26+
printf "%s" "${changes}\n"
27+
echo "git diff:"
28+
git --no-pager diff
29+
exit 1
30+
fi

0 commit comments

Comments
 (0)