Skip to content
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

[NET-6741] make: Add target for updating dependencies across all modules #3669

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ KIND_VERSION= $(shell ./control-plane/build-support/scripts/read-yaml-config.sh
KIND_NODE_IMAGE= $(shell ./control-plane/build-support/scripts/read-yaml-config.sh acceptance/ci-inputs/kind-inputs.yaml .kindNodeImage)
KUBECTL_VERSION= $(shell ./control-plane/build-support/scripts/read-yaml-config.sh acceptance/ci-inputs/kind-inputs.yaml .kubectlVersion)

GO_MODULES := $(shell find . -name go.mod -exec dirname {} \; | sort)

##@ Helm Targets

.PHONY: gen-helm-docs
Expand Down Expand Up @@ -317,6 +319,19 @@ go-mod-tidy: ## Recursively run go mod tidy on all subdirectories
check-mod-tidy: ## Recursively run go mod tidy on all subdirectories and check if there are any changes
@./control-plane/build-support/scripts/mod_tidy.sh --check

.PHONY: go-mod-get
go-mod-get: $(foreach mod,$(GO_MODULES),go-mod-get/$(mod)) ## Run go get and go mod tidy in every module for the given dependency

.PHONY: go-mod-get/%
go-mod-get/%:
ifndef DEP_VERSION
$(error DEP_VERSION is undefined: set this to <dependency>@<version>, e.g. github.com/hashicorp/go-hclog@v1.5.0)
endif
@echo "--> Running go get ${DEP_VERSION} ($*)"
@cd $* && go get $(DEP_VERSION)
@echo "--> Running go mod tidy ($*)"
@cd $* && go mod tidy
Comment on lines +330 to +333
Copy link
Member Author

@zalimeni zalimeni Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this repo has build-support/scripts/mod_tidy.sh, but since we're running these two commands back-to-back and don't need --check, it seemed simpler and about as clean to do it inline here (identical to consul) vs. calling that script as go-mod-tidy does.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. A lot of those scripts are pretty terrible too and should be replaces/deprecated...


##@ Release Targets

.PHONY: check-env
Expand Down
Loading