-
Notifications
You must be signed in to change notification settings - Fork 34
/
GNUmakefile
52 lines (40 loc) · 1.02 KB
/
GNUmakefile
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
SOURCE_FILES?=./...
PKG_NAME=mongodbatlas
GOLANGCI_VERSION=v1.52.2
COVERAGE=coverage.out
export GO111MODULE := on
export PATH := ./bin:$(PATH)
default: build
.PHONY: link-git-hooks
link-git-hooks:
find .git/hooks -type l -exec rm {} \;
find githooks -type f -exec ln -sf ../../{} .git/hooks/ \;
.PHONY: build
build:
go install ./$(PKG_NAME)
.PHONY: test
test:
go test $(SOURCE_FILES) -coverprofile $(COVERAGE) -timeout=30s -parallel=4 -cover -race
.PHONY: fmt
fmt:
@echo "==> Fixing source code with gofmt..."
gofmt -s -w ./$(PKG_NAME)
goimports -w ./$(PKG_NAME)
.PHONY: lint-fix
lint-fix:
golangci-lint run --fix
.PHONY: lint
lint:
golangci-lint run $(SOURCE_FILES)
.PHONY: check
check: test lint-fix
.PHONY: tools
tools:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s $(GOLANGCI_VERSION)
.PHONY: addcopy
addcopy:
@scripts/add-copy.sh
TAG=$(patsubst v%,%,$(shell git describe --tags --dirty --always))
.PHONY: check-version
check-version:
scripts/check-version.sh "$(TAG)"