-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
48 lines (37 loc) · 951 Bytes
/
Makefile
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
BINARY_NAME=treds
CLI_BINARY_NAME=treds-cli
# Use GOARCH and GOOS from environment, default to amd64 and the current OS.
GOARCH ?= amd64
GOOS ?= $(shell go env GOOS)
# Default build for current OS, using GOARCH and GOOS from env
build:
GOARCH=$(GOARCH) GOOS=$(GOOS) go build -o ${BINARY_NAME}
# Build the cli in the client folder
build-cli:
GOARCH=$(GOARCH) GOOS=$(GOOS) go build -o ${CLI_BINARY_NAME} ./client
# Run the default binary for the current OS
run: build
./${BINARY_NAME}
# Run the cli binary
run-cli: build-cli
./${CLI_BINARY_NAME}
# Clean up binaries
clean:
go clean
rm -f ${BINARY_NAME}
rm -f ${CLI_BINARY_NAME}
# Run tests
test:
go test $(filter-out $@,$(MAKECMDGOALS)) ./...
# Run tests with coverage
test_coverage:
go test $(filter-out $@,$(MAKECMDGOALS)) ./... -coverprofile=coverage.out
# Install dependencies
dep:
go mod download
# Vet the code
vet:
go vet
# Run linting
lint:
golangci-lint run --enable-all