From ef3afb434d3d065164b5b187a9d2894782c30757 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Sat, 26 Aug 2017 17:12:35 +0200 Subject: [PATCH] Update build templates * Update Makefile. * Update travis config. --- .travis.yml | 6 ++++-- Makefile | 22 +++++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9945a4a..a3ef9da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,10 @@ sudo: false language: go go: -- 1.7.5 -- 1.8 +- 1.8.x +- master + +go_import_path: github.com/prometheus/blackbox_exporter script: - make diff --git a/Makefile b/Makefile index e48243c..dedf806 100644 --- a/Makefile +++ b/Makefile @@ -11,10 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -GO := GO15VENDOREXPERIMENT=1 go -GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) -PROMU ?= $(GOPATH)/bin/promu -pkgs = $(shell $(GO) list ./... | grep -v /vendor/) +GO := GO15VENDOREXPERIMENT=1 go +FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) +PROMU := $(FIRST_GOPATH)/bin/promu +STATICCHECK := $(FIRST_GOPATH)/bin/staticcheck +pkgs = $(shell $(GO) list ./... | grep -v /vendor/) PREFIX ?= $(shell pwd) BIN_DIR ?= $(shell pwd) @@ -22,7 +23,7 @@ DOCKER_IMAGE_NAME ?= blackbox-exporter DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) -all: style build test +all: format vet staticcheck build test style: @echo ">> checking code style" @@ -40,6 +41,10 @@ vet: @echo ">> vetting code" @$(GO) vet $(pkgs) +staticcheck: $(STATICCHECK) + @echo ">> running staticcheck" + @$(STATICCHECK) $(pkgs) + build: $(PROMU) @echo ">> building binaries" @$(PROMU) build --prefix $(PREFIX) @@ -52,7 +57,10 @@ docker: @echo ">> building docker image" @docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" . -$(PROMU) promu: +$(FIRST_GOPATH)/bin/promu promu: @GOOS= GOARCH= $(GO) get -u github.com/prometheus/promu -.PHONY: all style format build test vet tarball docker promu +$(FIRST_GOPATH)/bin/staticcheck: + @GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck + +.PHONY: all style format build test vet tarball docker promu staticcheck $(FIRST_GOPATH)/bin/promu $(FIRST_GOPATH)/bin/staticcheck -- 2.25.1