-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (22 loc) · 899 Bytes
/
Copy pathMakefile
File metadata and controls
30 lines (22 loc) · 899 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
BINARY := lazywp
MODULE := github.com/hieuha/lazywp
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 := -ldflags "-X $(MODULE)/internal/cli.Version=$(VERSION) -X $(MODULE)/internal/cli.Commit=$(COMMIT) -X $(MODULE)/internal/cli.Date=$(DATE)"
.PHONY: build test lint clean install vet
build:
go build $(LDFLAGS) -o $(BINARY) ./cmd/lazywp
test:
go test ./... -v -count=1
test-coverage:
go test ./... -coverprofile=cover.out
go tool cover -html=cover.out -o cover.html
lint: vet
@which staticcheck >/dev/null 2>&1 && staticcheck ./... || echo "staticcheck not installed, skipping"
vet:
go vet ./...
clean:
rm -f $(BINARY) cover.out cover.html
install: build
cp $(BINARY) $(GOPATH)/bin/ 2>/dev/null || cp $(BINARY) ~/go/bin/