-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
55 lines (45 loc) · 1.25 KB
/
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
49
50
51
52
53
54
55
GOLANGCI_VERSION:=1.61.0
PROJECT_NAME:=go-corset
GOPATH_BIN:=$(shell go env GOPATH)/bin
.PHONY: install
install:
# Install golangci-lint for go code linting.
curl -sSfL \
"https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh" | \
sh -s -- -b ${GOPATH_BIN} v${GOLANGCI_VERSION}
# Install cobra-cli command generator.
go install github.com/spf13/cobra-cli@latest
.PHONY: all
all: clean lint test build
.PHONY: lint
lint:
@echo ">>> Performing golang code linting.."
golangci-lint run --config=.golangci.yml
.PHONY: test
test:
@echo ">>> Running Unit Tests..."
go test --timeout 0 -v ./...
.PHONY: qtest
qtest:
@echo ">>> Running (Quick) Tests..."
go test -v -race --run Test_ ./...
.PHONY: test-no-cache
test-no-cache:
@echo ">>> Running Unit Tests without Caching..."
go test -v -count=1 -race ./...
.PHONY: cover-test
cover-test:
@echo ">>> Running Tests with Coverage..."
go test -v -race ./... -coverprofile=coverage.out -covermode=atomic
.PHONY: show-cover
show-cover:
@go tool cover -html=coverage.out
.PHONY: build
build:
@echo ">>> Building ${PROJECT_NAME}..."
go build -o bin/${PROJECT_NAME} cmd/${PROJECT_NAME}/main.go
.PHONY: clean
clean:
@echo ">>> Removing old binaries and env files..."
@rm -rf bin/*
@rm -rf .env