Skip to content

Commit d6c14b4

Browse files
committed
Add verify-go-workspace make target
Introduce a new `verify-go-workspace` make target executed by the `verify` target. The pull-etcd-verify presubmit prow job will execute it. It ensures that the Go workspace (`go.work` and `go.work.sum`) is in sync. Signed-off-by: Ivan Valdes <[email protected]>
1 parent 6544f41 commit d6c14b4

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fuzz:
7777
verify: verify-gofmt verify-bom verify-lint verify-dep verify-shellcheck verify-goword \
7878
verify-govet verify-license-header verify-mod-tidy \
7979
verify-shellws verify-proto-annotations verify-genproto verify-yamllint \
80-
verify-govet-shadow verify-markdown-marker verify-go-versions
80+
verify-govet-shadow verify-markdown-marker verify-go-versions verify-go-workspace
8181

8282
.PHONY: fix
8383
fix: fix-bom fix-lint fix-yamllint sync-toolchain-directive update-go-workspace
@@ -217,6 +217,10 @@ clean:
217217
verify-go-versions:
218218
./scripts/verify_go_versions.sh
219219

220+
.PHONY: verify-go-workspace
221+
verify-go-workspace:
222+
PASSES="go_workspace" ./scripts/test.sh
223+
220224
.PHONY: sync-toolchain-directive
221225
sync-toolchain-directive:
222226
./scripts/sync_go_toolchain_directive.sh

scripts/test.sh

+11
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,17 @@ function genproto_pass {
639639
"${ETCD_ROOT_DIR}/scripts/verify_genproto.sh"
640640
}
641641

642+
function go_workspace_pass {
643+
log_callout "Ensuring go workspace is in sync."
644+
645+
run go mod download
646+
if [ -n "$(git status --porcelain go.work.sum)" ]; then
647+
log_error "Go workspace not in sync."
648+
log_warning "Suggestion: run \"make fix\" to address the issue."
649+
return 255
650+
fi
651+
}
652+
642653
########### MAIN ###############################################################
643654

644655
function run_pass {

0 commit comments

Comments
 (0)