Skip to content

Commit

Permalink
Fallback to gometalinter in CircleCI for now
Browse files Browse the repository at this point in the history
  • Loading branch information
errordeveloper committed Oct 11, 2018
1 parent e2035b4 commit c36d8a4
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .gometalinter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Enable": [
"vet",
"golint",
"errcheck",
"deadcode"
],
"Exclude": [
"^vendor\/",
"^build\/",
"^pkg\/nodebootstrap\/assets.go",
"\/usr\/local\/go"
],
"Deadline": "5m"
}
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ test: generate ## Run unit tests
@go test -v -covermode=count -coverprofile=coverage.out ./pkg/... ./cmd/...
@test -z $(COVERALLS_TOKEN) || $(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=circle-ci

ifeq ($(CIRCLECI),true)
LINTER := gometalinter ./...
else
LINTER := golangci-lint run
endif
.PHONY: lint
lint: ## Run linter over the codebase
@$(GOPATH)/bin/golangci-lint run
@$(GOPATH)/bin/$(LINTER)

.PHONY: ci
ci: test lint ## Target for CI system to invoke to run tests and linting
Expand Down Expand Up @@ -94,6 +99,7 @@ eksctl-image: eksctl-build-image ## Create the eksctl image
release: eksctl-build-image ## Create a new eksctl release
@docker run \
--env=GITHUB_TOKEN \
--env=CIRCLECI \
--env=CIRCLE_TAG \
--env=CIRCLE_PROJECT_USERNAME \
--volume=$(CURDIR):/go/src/github.com/weaveworks/eksctl \
Expand Down
32 changes: 31 additions & 1 deletion build/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,34 @@ go install ./vendor/golang.org/x/tools/cmd/stringer
go install ./vendor/github.com/mattn/goveralls
go install ./vendor/github.com/vektra/mockery/cmd/mockery

curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.10.2
# managing all linters that gometalinter uses with dep is going to take
# a lot of work, so we install all of those from the release tarball
install_gometalinter() {
version="${1}"
prefix="https://github.com/alecthomas/gometalinter/releases/download"
if [ "$(uname)" = "Darwin" ] ; then
suffix="darwin-amd64"
else
suffix="linux-amd64"
fi
basename="gometalinter-${version}-${suffix}"
url="${prefix}/v${version}/${basename}.tar.gz"
cd "${GOPATH}/bin/"
curl --silent --location "${url}" | tar xz
(cd "./${basename}/" ; mv ./* ../)
rmdir "./${basename}"
unset version prefix suffix basename url
}

install_golangci_lint() {
version="${1}"
curl --silent --fail --location \
"https://install.goreleaser.com/github.com/golangci/golangci-lint.sh" \
| sh -s -- -b $GOPATH/bin "${version}"
unset version
}

install_gometalinter "2.0.11"

## golangci-lint is broken in CircleCI
test -n "${CIRCLECI:-}" || install_golangci_lint "v1.10.2"

0 comments on commit c36d8a4

Please sign in to comment.