-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (31 loc) · 1.07 KB
/
Makefile
File metadata and controls
41 lines (31 loc) · 1.07 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
34
35
36
37
38
39
40
41
.PHONY: build test test-coverage lint fmt clean install deps run
BINARY_NAME=export-key
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_DATE=$(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
LDFLAGS=-ldflags "-s -w \
-X github.com/danmartuszewski/export-key/internal/cmd.Version=$(VERSION) \
-X github.com/danmartuszewski/export-key/internal/cmd.Commit=$(COMMIT) \
-X github.com/danmartuszewski/export-key/internal/cmd.BuildDate=$(BUILD_DATE)"
build:
CGO_ENABLED=0 go build $(LDFLAGS) -o bin/$(BINARY_NAME) ./cmd/export-key
test:
go test -v ./...
test-coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
lint:
golangci-lint run ./...
fmt:
go fmt ./...
clean:
rm -rf bin/ dist/ coverage.out coverage.html
install: build
cp bin/$(BINARY_NAME) /usr/local/bin/
codesign --sign - --force /usr/local/bin/$(BINARY_NAME)
deps:
go mod download
go mod tidy
run:
go run ./cmd/export-key $(ARGS)