mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-13 13:46:46 +00:00
Merge pull request #1286 from teawater/nogomode
Makefile: Change "GOPATH not set" to "No GO command"
This commit is contained in:
commit
2af09d1d58
14
Makefile
14
Makefile
@ -12,19 +12,11 @@ for file in /etc/os-release /usr/lib/os-release; do \
|
|||||||
fi \
|
fi \
|
||||||
done)
|
done)
|
||||||
|
|
||||||
HOST_ARCH=$(shell arch)
|
|
||||||
ifeq ($(GOPATH),)
|
|
||||||
SKIP_GO_VERSION_CHECK=y
|
|
||||||
else
|
|
||||||
SKIP_GO_VERSION_CHECK=
|
SKIP_GO_VERSION_CHECK=
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(SKIP_GO_VERSION_CHECK),)
|
|
||||||
include golang.mk
|
include golang.mk
|
||||||
endif
|
|
||||||
|
|
||||||
#Get ARCH.
|
#Get ARCH.
|
||||||
ifneq ($(GOPATH),)
|
ifneq (,$(golang_version_raw))
|
||||||
GOARCH=$(shell go env GOARCH)
|
GOARCH=$(shell go env GOARCH)
|
||||||
ifeq ($(ARCH),)
|
ifeq ($(ARCH),)
|
||||||
ARCH = $(GOARCH)
|
ARCH = $(GOARCH)
|
||||||
@ -608,7 +600,7 @@ show-footer:
|
|||||||
@printf "\tBugs: $(PROJECT_BUG_URL)\n\n"
|
@printf "\tBugs: $(PROJECT_BUG_URL)\n\n"
|
||||||
|
|
||||||
show-summary: show-header
|
show-summary: show-header
|
||||||
ifneq ($(GOPATH),)
|
ifneq (,$(golang_version_raw))
|
||||||
@printf "• architecture:\n"
|
@printf "• architecture:\n"
|
||||||
@printf "\tHost: $(HOST_ARCH)\n"
|
@printf "\tHost: $(HOST_ARCH)\n"
|
||||||
@printf "\tgolang: $(GOARCH)\n"
|
@printf "\tgolang: $(GOARCH)\n"
|
||||||
@ -618,7 +610,7 @@ ifneq ($(GOPATH),)
|
|||||||
@printf "\t"
|
@printf "\t"
|
||||||
@go version
|
@go version
|
||||||
else
|
else
|
||||||
@printf "• GOPATH not set:\n"
|
@printf "• No GO command or GOPATH not set:\n"
|
||||||
@printf "\tCan only install prebuilt binaries\n"
|
@printf "\tCan only install prebuilt binaries\n"
|
||||||
endif
|
endif
|
||||||
@printf "\n"
|
@printf "\n"
|
||||||
|
20
golang.mk
20
golang.mk
@ -6,6 +6,19 @@
|
|||||||
# Check that the system golang version is within the required version range
|
# Check that the system golang version is within the required version range
|
||||||
# for this project.
|
# for this project.
|
||||||
|
|
||||||
|
golang_version_raw=$(shell go version 2>/dev/null)
|
||||||
|
not_check_version=
|
||||||
|
ifeq (,$(GOPATH))
|
||||||
|
golang_version_raw=
|
||||||
|
endif
|
||||||
|
ifeq (,$(golang_version_raw))
|
||||||
|
not_check_version=y
|
||||||
|
endif
|
||||||
|
ifneq (,$(SKIP_GO_VERSION_CHECK))
|
||||||
|
not_check_version=y
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (,$(not_check_version))
|
||||||
have_yq=$(shell if [ -x "$(GOPATH)/bin/yq" ]; then echo "true"; else echo ""; fi)
|
have_yq=$(shell if [ -x "$(GOPATH)/bin/yq" ]; then echo "true"; else echo ""; fi)
|
||||||
ifeq (,$(have_yq))
|
ifeq (,$(have_yq))
|
||||||
$(info INFO: yq was not found, installing it)
|
$(info INFO: yq was not found, installing it)
|
||||||
@ -28,12 +41,6 @@ golang_version_min_minor=$(word 2,$(golang_version_min_fields))
|
|||||||
# for error messages
|
# for error messages
|
||||||
golang_version_needed=$(golang_version_min_major).$(golang_version_min_minor)
|
golang_version_needed=$(golang_version_min_major).$(golang_version_min_minor)
|
||||||
|
|
||||||
golang_version_raw=$(shell go version 2>/dev/null)
|
|
||||||
|
|
||||||
ifeq (,$(golang_version_raw))
|
|
||||||
$(error "ERROR: cannot determine golang version")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# determine actual version of golang
|
# determine actual version of golang
|
||||||
golang_version=$(subst go,,$(word 3,$(golang_version_raw)))
|
golang_version=$(subst go,,$(word 3,$(golang_version_raw)))
|
||||||
|
|
||||||
@ -52,3 +59,4 @@ endif
|
|||||||
ifeq (,$(golang_minor_ok))
|
ifeq (,$(golang_minor_ok))
|
||||||
$(error "ERROR: golang minor version too old: got $(golang_version), need atleast $(golang_version_needed)")
|
$(error "ERROR: golang minor version too old: got $(golang_version), need atleast $(golang_version_needed)")
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user