GO ?= go ifneq ($(DRONE_TAG),) VERSION ?= $(subst v,,$(DRONE_TAG)) LONG_VERSION ?= $(VERSION) else ifneq ($(DRONE_BRANCH),) VERSION ?= $(subst release/v,,$(DRONE_BRANCH)) else VERSION ?= master endif LONG_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//') endif LDFLAGS := $(LDFLAGS) -X "main.Version=$(LONG_VERSION)" .PHONY: build build: $(GO) build -ldflags '-s -w $(LDFLAGS)' .PHONY: lint lint: @hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ export BINARY="golangci-lint"; \ curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.1; \ fi golangci-lint run --timeout 5m .PHONY: fmt fmt: $(GO) fmt ./... .PHONY: test test: $(GO) test -race ./...