-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (25 loc) · 1.18 KB
/
Copy pathMakefile
File metadata and controls
33 lines (25 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
VER ?= `git show -s --format=%cd-%h --date=format:%y%m%d`
help: ## Displays help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-z0-9A-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
test: ## Run unit tests
@go test ./...
fmt: ## Format Go code with gofmt
@gofmt -w .
vet: ## Run go vet
@go vet ./...
lint: ## Check gofmt formatting and run go vet
@echo ">> checking gofmt"
@out=`gofmt -l .`; if [ -n "$$out" ]; then echo "not gofmt-ed:"; echo "$$out"; exit 1; fi
@echo ">> running go vet"
@go vet ./...
check: lint ## Run lint then tests with race detector
@go test -race ./...
build: ## Build binaries with version set
@CGO_ENABLED=0 go build -ldflags "-w -s \
-X github.com/prometheus/common/version.Version=${VER} \
-X github.com/prometheus/common/version.Revision=`git rev-parse HEAD` \
-X github.com/prometheus/common/version.Branch=`git rev-parse --abbrev-ref HEAD` \
-X github.com/prometheus/common/version.BuildUser=${USER}@`hostname` \
-X github.com/prometheus/common/version.BuildDate=`date +%Y%m%d-%H:%M:%S`"
docker: ## Builds 'thanos-kit' docker with no tag
@docker build -t "thanos-kit" .