From 9179d58eb1f3b07595012f24204bebab2327e756 Mon Sep 17 00:00:00 2001 From: joeduffy Date: Wed, 21 Jun 2017 14:23:48 -0700 Subject: [PATCH] Install GoMetaLinter in Travis And also rejigger the Makefiles to properly error if it's missing. --- .travis.yml | 5 +++-- Makefile | 4 ++++ README.md | 10 ++++++---- lib/aws/Makefile | 2 ++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2beffab07..ba4f113b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,9 @@ go: 1.8.2 before_install: # GoDep for Go dependency management. - go get -v github.com/tools/godep - # Golint for good Go hygiene. - - go get -v github.com/golang/lint/golint + # Gometalinter for good Go linting/hygiene. + - go get -v github.com/alecthomas/gometalinter + - gometalinter --install # Node.js 7.x for LumiJS and associated JS code. - nvm install v7 # Install Yarn as per https://yarnpkg.com/lang/en/docs/install-ci/#travis-tab. diff --git a/Makefile b/Makefile index e812d7d36..5a5969c2a 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +.SHELLFLAGS=-e + PROJECT=github.com/pulumi/lumi PROJECT_PKGS=$(shell go list ./cmd/... ./pkg/... | grep -v /vendor/) TESTPARALLELISM=10 @@ -34,6 +36,7 @@ install: .PHONY: lint lint: @echo "\033[0;32mLINT:\033[0m" + which gometalinter >/dev/null gometalinter pkg/... | sort ; exit "$${PIPESTATUS[0]}" gometalinter cmd/lumi/... | sort ; exit "$${PIPESTATUS[0]}" gometalinter cmd/lumidl/... | sort ; exit "$${PIPESTATUS[0]}" @@ -47,6 +50,7 @@ LINT_SUPPRESS="or be unexported|cyclomatic complexity|Subprocess launching with .PHONY: lint_quiet lint_quiet: @echo "\033[0;32mLINT (quiet):\033[0m" + which gometalinter >/dev/null gometalinter pkg/... | grep -vE ${LINT_SUPPRESS} | sort gometalinter cmd/lumi/... | grep -vE ${LINT_SUPPRESS} | sort gometalinter cmd/lumidl/... | grep -vE ${LINT_SUPPRESS} | sort diff --git a/README.md b/README.md index 3fc00b1dd..4ff047d01 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,13 @@ This section is for Lumi developers. ### Prerequisites -Lumi is written in Go, uses Godep for dependency management, and Golint for linting: +Lumi is written in Go, uses Godep for dependency management, and GoMetaLinter for linting: -* [Go](https://golang.org/doc/install): [download it](https://golang.org/dl) -* [Godep](https://github.com/tools/godep): `$ go get github.com/tools/godep` -* [Golint](https://github.com/golang/lint): `$ go get github.com/golang/lint/golint` +* [Go](https://golang.org/doc/install): https://golang.org/dl +* [Godep](https://github.com/tools/godep): `$ go get -v github.com/tools/godep` +* [GoMetaLinter](https://github.com/alecthomas/gometalinter): + - `$ go get -v github.com/golang/alecthomas/gometalinter` + - `$ gometalinter --install` ### Building and Testing diff --git a/lib/aws/Makefile b/lib/aws/Makefile index 27fd55309..5b1fd6dbb 100644 --- a/lib/aws/Makefile +++ b/lib/aws/Makefile @@ -48,6 +48,7 @@ install: lint: @echo "\033[0;32mLINT:\033[0m" ./pack/node_modules/.bin/tslint './pack/**/*.ts' --exclude='./pack/node_modules/**' + which gometalinter >/dev/null gometalinter provider/... | sort ; exit "$${PIPESTATUS[0]}" # In quiet mode, suppress some messages. @@ -59,6 +60,7 @@ LINT_SUPPRESS="or be unexported|cyclomatic complexity" lint_quiet: @echo "\033[0;32mLINT (quiet):\033[0m" ./pack/node_modules/.bin/tslint './pack/**/*.ts' --exclude='./pack/node_modules/**' + which gometalinter >/dev/null gometalinter provider/... | grep -vE ${LINT_SUPPRESS} | sort @test -z "$$(gometalinter provider/... | grep -vE ${LINT_SUPPRESS})" @echo "\033[0;33mgolint was run quietly; to run with noisy errors, run 'make lint'\033[0m"