improve makefile

pull/2/head
iwilltry42 6 years ago
parent 8758d5b48d
commit 76b80c40fa
  1. 1
      .travis.yml
  2. 11
      Makefile

@ -19,5 +19,4 @@ before_script:
- go install github.com/mitchellh/gox - go install github.com/mitchellh/gox
script: script:
- golangci-lint run
- make fmt check build-cross - make fmt check build-cross

@ -20,9 +20,9 @@ export GO111MODULE=on
# go source files, ignore vendor directory # go source files, ignore vendor directory
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*") SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
.PHONY: all build build-cross clean fmt simplify check bootstrap .PHONY: all build build-cross clean fmt simplify check
all: check build all: clean fmt check build
build: build:
$(GO) build -i $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)/$(BINARIES)' $(GO) build -i $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)/$(BINARIES)'
@ -42,13 +42,16 @@ simplify:
check: check:
@test -z $(shell gofmt -l main.go | tee /dev/stderr) || echo "[WARN] Fix formatting issues with 'make fmt'" @test -z $(shell gofmt -l main.go | tee /dev/stderr) || echo "[WARN] Fix formatting issues with 'make fmt'"
@for d in $$(go list ./... | grep -v /vendor/); do golint $${d}; done @golangci-lint run
@go vet ${SRC} @go vet ${SRC}
# Check for required executables # Check for required executables
HAS_GOX := $(shell command -v gox 2> /dev/null) HAS_GOX := $(shell command -v gox 2> /dev/null)
HAS_GOLANGCI := $(shell command -v golangci-lint 2> /dev/null)
bootstrap:
ifndef HAS_GOX ifndef HAS_GOX
go get -u github.com/mitchellh/gox go get -u github.com/mitchellh/gox
endif endif
ifndef HAS_GOLANGCI
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
endif
Loading…
Cancel
Save