-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (41 loc) · 1.04 KB
/
Copy pathMakefile
File metadata and controls
53 lines (41 loc) · 1.04 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
42
43
44
45
46
47
48
49
50
51
52
53
BINARY := bodek
PKG := ./cmd/bodek
GOBIN ?= $(shell go env GOPATH)/bin
.PHONY: all build install run fmt vet lint test cover tidy clean
all: build
## build: compile the bodek binary into ./bin
build:
@mkdir -p bin
go build -o bin/$(BINARY) $(PKG)
## install: install bodek into $GOBIN
install:
go install $(PKG)
## run: build and launch bodek (spawns `odek serve`)
run: build
./bin/$(BINARY)
## fmt: format all Go sources
fmt:
go fmt ./...
## vet: run go vet
vet:
go vet ./...
## lint: run golangci-lint if available
lint:
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run ./...; \
else \
echo "golangci-lint not installed; skipping (see https://golangci-lint.run)"; \
fi
## test: run the race-enabled test suite
test:
go test -race ./...
## cover: print internal-package coverage
cover:
go test -coverpkg=./internal/... -coverprofile=coverage.out ./internal/...
go tool cover -func=coverage.out | tail -1
## tidy: tidy module dependencies
tidy:
go mod tidy
## clean: remove build artifacts
clean:
rm -rf bin