ci: move go vet to validate check (#430)

* ci: move go vet to validate check

Signed-off-by: Paulo Pires <pjpires@gmail.com>

* cri: don't build when not on linux

Signed-off-by: Paulo Pires <pjpires@gmail.com>
This commit is contained in:
Paulo Pires
2018-11-30 21:58:55 +00:00
committed by Brian Goff
parent ea40a180f4
commit 0e9cfca585
3 changed files with 16 additions and 3 deletions

View File

@@ -6,6 +6,9 @@ jobs:
working_directory: /go/src/github.com/virtual-kubelet/virtual-kubelet working_directory: /go/src/github.com/virtual-kubelet/virtual-kubelet
steps: steps:
- checkout - checkout
- run:
name: go vet
command: V=1 CI=1 make vet
- run: - run:
name: Install linters 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/ command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.10.2 && mv ./bin/* /go/bin/

View File

@@ -60,19 +60,27 @@ clean:
@echo "Clean..." @echo "Clean..."
$Q rm -rf bin $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: test:
@echo "Testing..." @echo "Testing..."
$Q go test $(if $V,-v) -i $(allpackages) # install -race libs to speed up next run $Q go test $(if $V,-v) -i $(allpackages) # install -race libs to speed up next run
ifndef CI ifndef CI
@echo "Testing Outside CI..." @echo "Testing Outside CI..."
$Q go vet $(allpackages)
$Q GODEBUG=cgocheck=2 go test $(allpackages) $Q GODEBUG=cgocheck=2 go test $(allpackages)
else else
@echo "Testing in CI..." @echo "Testing in CI..."
$Q mkdir -p test $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 $$? ) | \ $Q ( GODEBUG=cgocheck=2 go test -v $(allpackages); echo $$? ) | \
tee test/output.txt | sed '$$ d'; exit $$(tail -1 test/output.txt) tee test/output.txt | sed '$$ d'; exit $$(tail -1 test/output.txt)
endif endif

View File

@@ -1,3 +1,5 @@
// +build linux
package cri package cri
import ( import (