@ -10,14 +10,17 @@ ifeq ($(GIT_TAG),)
GIT_TAG := $( shell git describe --always)
GIT_TAG := $( shell git describe --always)
e n d i f
e n d i f
# get latest k3s version
# get latest k3s version: grep the tag JSON field, extract the tag and replace + with - (difference between git and dockerhub tags)
K3S_TAG := $( shell curl --silent "https://api.github.com/repos/rancher/k3s/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' )
K3S_TAG := $( shell curl --silent "https://api.github.com/repos/rancher/k3s/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed -E 's/\+/\-/' )
i f e q ( $( K 3S_TAG ) , )
i f e q ( $( K 3S_TAG ) , )
$(warning K3S_TAG undefined : couldn 't get latest k 3s image tag !)
$(warning K3S_TAG undefined : couldn 't get latest k 3s image tag !)
$(warning Output of curl : $( shell curl --silent "https ://api .github .com /repos /rancher /k 3s /releases /latest ") )
$(warning Output of curl : $( shell curl --silent "https ://api .github .com /repos /rancher /k 3s /releases /latest ") )
$( error exiting )
$( error exiting )
e n d i f
e n d i f
# determine if make is being executed from interactive terminal
INTERACTIVE := $( shell [ -t 0 ] && echo 1)
# Go options
# Go options
GO ?= go
GO ?= go
PKG := $( shell go mod vendor)
PKG := $( shell go mod vendor)
@ -32,8 +35,8 @@ BINARIES := k3d
# Go Package required
# Go Package required
PKG_GOX := github.com/mitchellh/gox@v1.0.1
PKG_GOX := github.com/mitchellh/gox@v1.0.1
PKG_GOLANGCI_LINT_VERSION := v1.20.0
PKG_GOLANGCI_LINT_VERSION := 1.22.2
PKG_GOLANGCI_LINT := github.com/golangci/golangci-lint/cmd/golangci-lint@${ PKG_GOLANGCI_LINT_VERSION }
PKG_GOLANGCI_LINT := github.com/golangci/golangci-lint/cmd/golangci-lint@v ${ PKG_GOLANGCI_LINT_VERSION }
# configuration adjustments for golangci-lint
# configuration adjustments for golangci-lint
GOLANGCI_LINT_DISABLED_LINTERS := "" # disabling typecheck, because it currently (06.09.2019) fails with Go 1.13
GOLANGCI_LINT_DISABLED_LINTERS := "" # disabling typecheck, because it currently (06.09.2019) fails with Go 1.13
@ -87,12 +90,23 @@ check: check-fmt lint
# Check for required executables
# Check for required executables
HAS_GOX := $( shell command -v gox 2> /dev/null)
HAS_GOX := $( shell command -v gox 2> /dev/null)
HAS_GOLANGCI := $( shell command -v golangci-lint 2> /dev/null)
HAS_GOLANGCI := $( shell command -v golangci-lint)
HAS_GOLANGCI_VERSION := $( shell golangci-lint --version | grep " version $( PKG_GOLANGCI_LINT_VERSION) " 2>& 1)
install-tools :
install-tools :
i f n d e f H A S _ G O X
i f n d e f H A S _ G O X
( $( GO) get $( PKG_GOX) )
( $( GO) get $( PKG_GOX) )
e n d i f
e n d i f
i f n d e f H A S _ G O L A N G C I
i f n d e f H A S _ G O L A N G C I
( curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ${ GOPATH } /bin ${ PKG_GOLANGCI_LINT_VERSION } )
( curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ${ GOPATH } /bin v${ PKG_GOLANGCI_LINT_VERSION } )
e n d i f
i f d e f H A S _ G O L A N G C I
i f e q ( $( HAS_GOLANGCI_VERSION ) , )
i f d e f I N T E R A C T I V E
@echo " Warning: Your installed version of golangci-lint (interactive: ${ INTERACTIVE } ) differs from what we'd like to use. Switch to v ${ PKG_GOLANGCI_LINT_VERSION } ? [Y/n] "
@read line; if [ $$ line = = "y" ] ; then ( curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ${ GOPATH } /bin v${ PKG_GOLANGCI_LINT_VERSION } ) ; fi
e l s e
@echo " Warning: you're not using the same version of golangci-lint as us (v ${ PKG_GOLANGCI_LINT_VERSION } ) "
e n d i f
e n d i f
e n d i f
e n d i f