Manual backport of [NET-6741] make: Add target for updating dependencies across all modules into release/1.15.x (#20687)

* backport of commit 6f0e24cda7

* partial backport of commit 77f44fa878

Update go-mod-tidy Make target to use flexible modules list.

This will update the list to include envoyextensions and troubleshoot.
pull/20803/head
Michael Zalimeni 2024-02-27 11:48:54 -05:00 committed by GitHub
parent 5c0fcf75e2
commit 4a88465eba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 12 deletions

View File

@ -3,6 +3,8 @@
SHELL = bash SHELL = bash
GO_MODULES := $(shell find . -name go.mod -exec dirname {} \; | grep -v "proto-gen-rpc-glue/e2e" | sort)
### ###
# These version variables can either be a valid string for "go install <module>@<version>" # These version variables can either be a valid string for "go install <module>@<version>"
# or the string @DEV to imply use what is currently installed locally. # or the string @DEV to imply use what is currently installed locally.
@ -10,6 +12,7 @@ SHELL = bash
GOLANGCI_LINT_VERSION='v1.55.2' GOLANGCI_LINT_VERSION='v1.55.2'
MOCKERY_VERSION='v2.20.0' MOCKERY_VERSION='v2.20.0'
BUF_VERSION='v1.4.0' BUF_VERSION='v1.4.0'
PROTOC_GEN_GO_GRPC_VERSION="v1.2.0" PROTOC_GEN_GO_GRPC_VERSION="v1.2.0"
MOG_VERSION='v0.4.0' MOG_VERSION='v0.4.0'
PROTOC_GO_INJECT_TAG_VERSION='v1.3.0' PROTOC_GO_INJECT_TAG_VERSION='v1.3.0'
@ -239,19 +242,26 @@ cov: other-consul dev-build
test: other-consul dev-build lint test-internal test: other-consul dev-build lint test-internal
go-mod-tidy: .PHONY: go-mod-tidy
@echo "--> Running go mod tidy" go-mod-tidy: $(foreach mod,$(GO_MODULES),go-mod-tidy/$(mod))
@cd sdk && go mod tidy
@cd api && go mod tidy
@go mod tidy
@cd test/integration/consul-container && go mod tidy
@cd test/integration/connect/envoy/test-sds-server && go mod tidy
@cd proto-public && go mod tidy
@cd internal/tools/proto-gen-rpc-glue && go mod tidy
@cd internal/tools/proto-gen-rpc-glue/e2e && go mod tidy
@cd internal/tools/proto-gen-rpc-glue/e2e/consul && go mod tidy
@cd internal/tools/protoc-gen-consul-rate-limit && go mod tidy
.PHONY: mod-tidy/%
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
test-internal: test-internal:
@echo "--> Running go test" @echo "--> Running go test"