From 22db848a47df20989ca6af8ed5cd20f9fb476da4 Mon Sep 17 00:00:00 2001 From: umarcor Date: Sun, 1 Mar 2020 02:48:56 +0100 Subject: [PATCH] fix: review comments --- .gitignore | 3 --- .travis.yml | 6 +----- Makefile | 18 +++++++++++------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 31c303476..c7b459e4d 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,3 @@ bin .idea/ *.iml - -# test-generated files -cobra/cmd/testproject diff --git a/.travis.yml b/.travis.yml index 16f7c0da2..437a3c031 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: go stages: - - lint - test - build @@ -15,15 +14,12 @@ env: GO111MODULE=on before_install: - go get -u github.com/kyoh86/richgo - go get -u github.com/mitchellh/gox + - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin latest matrix: allow_failures: - go: tip include: - - stage: lint - go: 1.13.x - before_install: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin latest - script: golangci-lint run -v - stage: build go: 1.13.x script: make cobra_generator diff --git a/Makefile b/Makefile index e9740d1e1..dd2ccd601 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,29 @@ BIN="./bin" SRC=$(shell find . -name "*.go") +ifeq (, $(shell which golangci-lint)) +$(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh") +endif + ifeq (, $(shell which richgo)) $(warning "could not find richgo in $(PATH), run: go get github.com/kyoh86/richgo") endif -.PHONY: fmt vet test cobra_generator install_deps clean +.PHONY: fmt lint test cobra_generator install_deps clean default: all -all: fmt vet test cobra_generator +all: fmt lint test cobra_generator fmt: $(info ******************** checking formatting ********************) @test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1) -test: install_deps vet +lint: + $(info ******************** running lint tools ********************) + golangci-lint run -v + +test: install_deps lint $(info ******************** running tests ********************) richgo test -v ./... @@ -28,9 +36,5 @@ install_deps: $(info ******************** downloading dependencies ********************) go get -v ./... -vet: - $(info ******************** vetting ********************) - go vet ./... - clean: rm -rf $(BIN)