-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (27 loc) · 993 Bytes
/
Makefile
File metadata and controls
37 lines (27 loc) · 993 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 test test-race lint clean install coverage coverage-gate
BINARY := dockercomms
VERSION ?= dev
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo "unknown")
LDFLAGS := -ldflags "-X github.com/codethor0/dockercomms/internal/version.Version=$(VERSION) -X github.com/codethor0/dockercomms/internal/version.Commit=$(COMMIT) -X github.com/codethor0/dockercomms/internal/version.Date=$(DATE)"
build:
go build $(LDFLAGS) -o $(BINARY) ./cmd/dockercomms
install:
go install ./cmd/dockercomms
test:
go test ./...
test-race:
go test -race ./...
coverage:
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
coverage-gate: coverage
@go run ./internal/tools/covergate coverage.out
lint:
go fmt ./...
go vet ./...
@if command -v golangci-lint >/dev/null 2>&1; then golangci-lint run ./...; fi
clean:
rm -f $(BINARY)
go clean -cache -testcache
all: lint test build