From faa7575edcbfbd7ce10c6b8d4dc3538486c47903 Mon Sep 17 00:00:00 2001 From: Oscar Utbult Date: Fri, 4 Nov 2022 17:05:08 +0100 Subject: [PATCH] Get Makefile dependency versions from go.mod --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9db1137afe96..fc5d1163cec1 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,10 @@ ifneq ($(strip $(GINKGO_SKIP)),) _SKIP_ARGS := $(foreach arg,$(strip $(GINKGO_SKIP)),-skip="$(arg)") endif +# Helper function to get dependency versions from go.mod instead of having to +# hardcode them in the Makefile. +get_go_version = $(shell go list -m $1 | awk '{print $$2}') + # # Binaries. # @@ -125,8 +129,8 @@ CONVERSION_GEN_BIN := conversion-gen CONVERSION_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN)) CONVERSION_GEN_PKG := k8s.io/code-generator/cmd/conversion-gen -ENVSUBST_VER := v2.0.0-20210730161058-179042472c46 ENVSUBST_BIN := envsubst +ENVSUBST_VER := $(call get_go_version,$(github.com/drone/envsubst/v2)) ENVSUBST := $(abspath $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)-$(ENVSUBST_VER)) ENVSUBST_PKG := github.com/drone/envsubst/v2/cmd/envsubst @@ -148,8 +152,8 @@ YQ_BIN := yq YQ := $(abspath $(TOOLS_BIN_DIR)/$(YQ_BIN)-$(YQ_VER)) YQ_PKG := github.com/mikefarah/yq/v4 -GINGKO_VER := v2.4.0 GINKGO_BIN := ginkgo +GINGKO_VER := $(call get_go_version,github.com/onsi/ginkgo/v2) GINKGO := $(abspath $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINGKO_VER)) GINKGO_PKG := github.com/onsi/ginkgo/v2/ginkgo