-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (37 loc) · 1.13 KB
/
Makefile
File metadata and controls
46 lines (37 loc) · 1.13 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
# Set up GOBIN so that our binaries are installed to ./bin instead of $GOPATH/bin.
PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
export GOBIN = $(PROJECT_ROOT)/bin
GOLANGCI_LINT_VERSION := $(shell golangci-lint --version 2>/dev/null)
.PHONY: all
all: build lint test
.PHONY: build
build:
go install go.uber.org/nilaway/cmd/nilaway@latest
.PHONY: test
test:
go test -v -race ./...
.PHONY: cover
cover:
go test -v -race -coverprofile=cover.out -coverpkg=./... -v ./...
go tool cover -html=cover.out -o cover.html
.PHONY: lint
lint: golangci-lint nilaway-lint tidy-lint
.PHONY: golangci-lint
golangci-lint:
ifdef GOLANGCI_LINT_VERSION
@echo "[lint] $(GOLANGCI_LINT_VERSION)"
else
$(error "golangci-lint not found, please install it from https://golangci-lint.run/usage/install/#local-installation")
endif
@echo "[lint] golangci-lint run"
@golangci-lint run
.PHONY: tidy-lint
tidy-lint:
@echo "[lint] go mod tidy"
@go mod tidy && \
git diff --exit-code -- go.mod go.sum || \
(echo "'go mod tidy' changed files" && false)
.PHONY: nilaway-lint
nilaway-lint: build
@echo "[lint] nilaway linting package"
@$(GOBIN)/nilaway .