-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (26 loc) · 842 Bytes
/
Copy pathMakefile
File metadata and controls
37 lines (26 loc) · 842 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
32
33
34
35
36
37
.PHONY: build build-all test lint install clean docs
BINARY := mate
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -ldflags "-X main.version=$(VERSION)"
build:
go build $(LDFLAGS) -o $(BINARY) ./cmd/mate
build-all: build-darwin-arm64 build-linux-amd64
build-darwin-arm64:
GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o dist/$(BINARY)-darwin-arm64 ./cmd/mate
build-linux-amd64:
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o dist/$(BINARY)-linux-amd64 ./cmd/mate
test:
go test -race -cover ./...
lint:
golangci-lint run
install: build
cp $(BINARY) $(GOPATH)/bin/
clean:
rm -f $(BINARY)
rm -f coverage.out coverage.html
rm -rf docs/ dist/
coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
docs:
go run ./cmd/gendocs docs/