Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
Latest commit
31 lines (23 loc) · 792 Bytes
/
Copy pathMakefile
File metadata and controls
31 lines (23 loc) · 792 Bytes
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
BINARY := loopguard
MODULE := github.com/loop-eng/loopguard
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -s -w \
-X '$(MODULE)/internal/cli.version=$(VERSION)' \
-X '$(MODULE)/internal/cli.commit=$(COMMIT)' \
-X '$(MODULE)/internal/cli.date=$(DATE)'
.PHONY: build test lint run clean install
build:
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/loopguard
run: build
./bin/$(BINARY)
test:
go test -race -count=1 ./...
lint:
golangci-lint run ./...
clean:
rm -rf bin/
install: build
cp bin/$(BINARY)$(GOPATH)/bin/$(BINARY)2>/dev/null || cp bin/$(BINARY)~/go/bin/$(BINARY)
.DEFAULT_GOAL := build