Skip to content

Commit 14e617e

Browse files
Adding go version check when building locally. (#1209)
* Adding go version check when building locally.
1 parent f50f452 commit 14e617e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ BUILD := .build
2323
# usually unnecessary to clean, and may require downloads to restore, so this folder is not automatically cleaned.
2424
BIN := .bin
2525

26+
# current (when committed) version of Go used in CI, and ideally also our docker images.
27+
# this generally does not matter, but can impact goimports or formatting output.
28+
# for maximum stability, make sure you use the same version as CI uses.
29+
#
30+
# this can _likely_ remain a major version, as fmt output does not tend to change in minor versions,
31+
# which will allow findstring to match any minor version.
32+
EXPECTED_GO_VERSION := go1.16
33+
CURRENT_GO_VERSION := $(shell go version)
34+
ifeq (,$(findstring $(EXPECTED_GO_VERSION),$(CURRENT_GO_VERSION)))
35+
# if you are seeing this warning: consider using https://github.com/travis-ci/gimme to pin your version
36+
$(warning Caution: you are not using CI's go version. Expected: $(EXPECTED_GO_VERSION), current: $(CURRENT_GO_VERSION))
37+
endif
38+
2639
# ====================================
2740
# book-keeping files that are used to control sequencing.
2841
#

0 commit comments

Comments
 (0)