From 0e9cfca585d346602df6297658717d6da4f66fba Mon Sep 17 00:00:00 2001 From: Paulo Pires Date: Fri, 30 Nov 2018 21:58:55 +0000 Subject: [PATCH] ci: move go vet to validate check (#430) * ci: move go vet to validate check Signed-off-by: Paulo Pires * cri: don't build when not on linux Signed-off-by: Paulo Pires --- .circleci/config.yml | 3 +++ Makefile | 14 +++++++++++--- providers/cri/cri.go | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7ccfce0fe..3ca5b50b1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,9 @@ jobs: working_directory: /go/src/github.com/virtual-kubelet/virtual-kubelet steps: - checkout + - run: + name: go vet + command: V=1 CI=1 make vet - run: name: Install linters command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.10.2 && mv ./bin/* /go/bin/ diff --git a/Makefile b/Makefile index da2aa8268..622bbb129 100644 --- a/Makefile +++ b/Makefile @@ -60,19 +60,27 @@ clean: @echo "Clean..." $Q rm -rf bin +vet: + @echo "go vet'ing..." +ifndef CI + @echo "go vet'ing Outside CI..." + $Q go vet $(allpackages) +else + @echo "go vet'ing in CI..." + $Q mkdir -p test + $Q ( go vet $(allpackages); echo $$? ) | \ + tee test/vet.txt | sed '$$ d'; exit $$(tail -1 test/vet.txt) +endif test: @echo "Testing..." $Q go test $(if $V,-v) -i $(allpackages) # install -race libs to speed up next run ifndef CI @echo "Testing Outside CI..." - $Q go vet $(allpackages) $Q GODEBUG=cgocheck=2 go test $(allpackages) else @echo "Testing in CI..." $Q mkdir -p test - $Q ( go vet $(allpackages); echo $$? ) | \ - tee test/vet.txt | sed '$$ d'; exit $$(tail -1 test/vet.txt) $Q ( GODEBUG=cgocheck=2 go test -v $(allpackages); echo $$? ) | \ tee test/output.txt | sed '$$ d'; exit $$(tail -1 test/output.txt) endif diff --git a/providers/cri/cri.go b/providers/cri/cri.go index d838a8163..15b65c4d5 100644 --- a/providers/cri/cri.go +++ b/providers/cri/cri.go @@ -1,3 +1,5 @@ +// +build linux + package cri import (