Skip to content

Commit 13616a3

Browse files
authored
Merge pull request #7503 from oscr/backup-makefile-get-go-version
✨ Get Ginkgo version in Makefile from go.mod
2 parents fc5d8d1 + cfc1b67 commit 13616a3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ ifneq ($(strip $(GINKGO_SKIP)),)
9494
_SKIP_ARGS := $(foreach arg,$(strip $(GINKGO_SKIP)),-skip="$(arg)")
9595
endif
9696

97+
# Helper function to get dependency version from go.mod
98+
get_go_version = $(shell go list -m $1 | awk '{print $$2}')
99+
97100
#
98101
# Binaries.
99102
#
@@ -125,8 +128,8 @@ CONVERSION_GEN_BIN := conversion-gen
125128
CONVERSION_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN))
126129
CONVERSION_GEN_PKG := k8s.io/code-generator/cmd/conversion-gen
127130

128-
ENVSUBST_VER := v2.0.0-20210730161058-179042472c46
129131
ENVSUBST_BIN := envsubst
132+
ENVSUBST_VER := $(call get_go_version,github.com/drone/envsubst/v2)
130133
ENVSUBST := $(abspath $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)-$(ENVSUBST_VER))
131134
ENVSUBST_PKG := github.com/drone/envsubst/v2/cmd/envsubst
132135

@@ -148,8 +151,8 @@ YQ_BIN := yq
148151
YQ := $(abspath $(TOOLS_BIN_DIR)/$(YQ_BIN)-$(YQ_VER))
149152
YQ_PKG := github.com/mikefarah/yq/v4
150153

151-
GINGKO_VER := v2.5.0
152154
GINKGO_BIN := ginkgo
155+
GINGKO_VER := $(call get_go_version,github.com/onsi/ginkgo/v2)
153156
GINKGO := $(abspath $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINGKO_VER))
154157
GINKGO_PKG := github.com/onsi/ginkgo/v2/ginkgo
155158

0 commit comments

Comments
 (0)