mirror of https://github.com/status-im/consul.git
[NET-6741] make: Add target for updating dependencies across all modules (#19785)
make: Add target for updating dependencies across all modules To enable more consistent and error-proof dependency management, add a Make target that will set a dependency version across all submodules that require it. Also runs `go mod tidy`. This first ensures the dependency addition is reverted if the module in question does not require it; it also ensures that any additional cleanup needed in `go.mod`/`go.sum` is applied.
This commit is contained in:
parent
8ba919f913
commit
858691b6ae
13
Makefile
13
Makefile
|
@ -239,6 +239,19 @@ go-mod-tidy/%:
|
|||
@echo "--> Running go mod tidy ($*)"
|
||||
@cd $* && go mod tidy
|
||||
|
||||
.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
|
||||
|
||||
##@ Checks
|
||||
|
||||
.PHONY: fmt
|
||||
|
|
Loading…
Reference in New Issue