From 926cd52a7fdb681b62665da0ada8bbb110bb55ac Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 26 Jan 2018 12:02:44 +0000 Subject: [PATCH] Makefile: make full tests run on go1.10+ as well as go1.9 --- Makefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index d494b999a..0373a2bb0 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ LAST_TAG := $(shell git describe --tags --abbrev=0) NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f", $$_)') GO_VERSION := $(shell go version) GO_FILES := $(shell go list ./... | grep -v /vendor/ ) -GO_LATEST := $(findstring go1.9,$(GO_VERSION)) +# Run full tests if go >= go1.9 +FULL_TESTS := $(shell go version | perl -lne 'print "go$$1.$$2" if /go(\d+)\.(\d+)/ && ($$1 > 1 || $$2 >= 9)') BETA_URL := https://beta.rclone.org/$(TAG)/ # Pass in GOTAGS=xyz on the make command line to set build tags ifdef GOTAGS @@ -24,7 +25,7 @@ vars: @echo LAST_TAG="'$(LAST_TAG)'" @echo NEW_TAG="'$(NEW_TAG)'" @echo GO_VERSION="'$(GO_VERSION)'" - @echo GO_LATEST="'$(GO_LATEST)'" + @echo FULL_TESTS="'$(FULL_TESTS)'" @echo BETA_URL="'$(BETA_URL)'" version: @@ -40,24 +41,24 @@ test: rclone # Quick test quicktest: RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) $(GO_FILES) -ifdef GO_LATEST +ifdef FULL_TESTS RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) -cpu=2 -race $(GO_FILES) endif # Do source code quality checks check: rclone -ifdef GO_LATEST +ifdef FULL_TESTS go vet $(BUILDTAGS) -printfuncs Debugf,Infof,Logf,Errorf ./... errcheck $(BUILDTAGS) ./... find . -name \*.go | grep -v /vendor/ | xargs goimports -d | grep . ; test $$? -eq 1 go list ./... | xargs -n1 golint | grep -E -v '(StorageUrl|CdnUrl)' ; test $$? -eq 1 else - @echo Skipping tests as not on Go stable + @echo Skipping source quality tests as version of go too old endif # Get the build dependencies build_dep: -ifdef GO_LATEST +ifdef FULL_TESTS go get -u github.com/kisielk/errcheck go get -u golang.org/x/tools/cmd/goimports go get -u github.com/golang/lint/golint @@ -126,10 +127,10 @@ upload_beta: @echo Beta release ready at $(BETA_URL) compile_all: -ifdef GO_LATEST +ifdef FULL_TESTS go run bin/cross-compile.go -parallel 8 -compile-only $(BUILDTAGS) $(TAG)β else - @echo Skipping compile all as not on Go stable + @echo Skipping compile all as version of go too old endif travis_beta: