-
Notifications
You must be signed in to change notification settings - Fork 46
/
Makefile
43 lines (34 loc) · 1.1 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
PKG_LIST := $(shell go list ./...)
.PHONY: setup
setup: ## Install build, test, and lint dependencies
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.29.0
go install github.com/golang/mock/mockgen
curl -sSfL https://raw.githubusercontent.com/jckuester/go-acc/master/install.sh | sh -s v0.2.1
.PHONY: lint
lint: ## Run some static code analysis
./bin/golangci-lint run --enable-all
.PHONY: go-mod-tidy
go-mod-tidy: ## Clean go.mod
@go mod tidy -v
@git diff HEAD
@git diff-index --quiet HEAD
.PHONY: fmt
fmt: ## Run gofmt on goimports all files
gofmt -w -l -s .
goimports -w -l .
PHONY: generate
generate: ## Run go generate
go generate
.PHONY: test
test: ## Run unit tests
go clean -testcache ${PKG_LIST}
go test -v -p 1 -short -race ${PKG_LIST}
.PHONY: test-all
test-all: ## Run tests (including acceptance and integration tests)
go clean -testcache ${PKG_LIST}
./bin/go-acc ${PKG_LIST} -- -v $(TESTARGS) -p 1 -race -timeout 60m
.PHONY: build
build: ## Build binary
go build
.PHONY: build
ci: generate build test-all # Run all the tests and code checks