-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run test-go-mod
on local modules
#4975
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,7 +152,9 @@ functions-examples-all: | |
done | ||
|
||
test-go-mod: | ||
./hack/for-each-module.sh "go list -m -json all > /dev/null && go mod tidy -v" | ||
./hack/for-each-module.sh $$(pwd)/hack/replace.sh; \ | ||
./hack/for-each-module.sh "go mod tidy -v"; \ | ||
./hack/for-each-module.sh $$(pwd)/hack/dropReplace.sh | ||
Comment on lines
+155
to
+157
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried inlining the scripts in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think calling a script from here is better than inlining the details anyway. :) I'd suggest making a single script we can invoke from here like |
||
|
||
.PHONY: | ||
verify-kustomize-e2e: $(MYGOBIN)/mdrip $(MYGOBIN)/kind | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2023 The Kubernetes Authors. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
read -a modules <<< $(go list -m) | ||
|
||
for i in ${!modules[@]}; do | ||
go mod edit -dropreplace=${modules[i]} | ||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2023 The Kubernetes Authors. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
read -a modules <<< $(go list -m) | ||
read -a module_paths <<< $(go list -m -f {{.Dir}}) | ||
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to move this into
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm assuming I've considered 2 alternatives:
|
||
|
||
for i in ${!modules[@]}; do | ||
replace_path=$(realpath --relative-to=$(pwd) ${module_paths[i]}) | ||
if [ $replace_path == . ]; then | ||
continue | ||
fi | ||
go mod edit -replace=${modules[i]}=$replace_path | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using
$$KUSTOMIZE_ROOT
instead of$$(pwd)
, but couldn't figure out how to use the exportedhack/for-each-module.sh
variable here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
"\$$KUSTOMIZE_ROOT/hack/...
should work!