-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (31 loc) · 889 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
.DEFAULT_GOAL=build
export GO111MODULE=on
.PHONY: build
build: build/snowflake
GO_SOURCES=$(shell find . -type f -name "*.go") go.mod go.sum
GO_BUILD=go build -o $(2) $(1)
build/snowflake: $(GO_SOURCES)
$(call GO_BUILD,.,$@)
.PHONY: test
test:
go test ./...
.PHONY: lint
lint: \
golangci-lint
GOLANGCI_LINT_VERSION=v1.17.1
GOLANGCI_LINT_DIR=$(shell go env GOPATH)/pkg/golangci-lint/$(GOLANGCI_LINT_VERSION)
$(GOLANGCI_LINT_DIR):
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOLANGCI_LINT_DIR) $(GOLANGCI_LINT_VERSION)
.PHONY: install-golangci-lint
install-golangci-lint: $(GOLANGCI_LINT_DIR)
.PHONY: golangci-lint
golangci-lint: install-golangci-lint
$(GOLANGCI_LINT_DIR)/golangci-lint run
.PHONY: mod-update
mod-update:
go get -u
$(MOD_TIDY)
MOD_TIDY=rm -f go.sum && go mod tidy
.PHONY: mod-tidy
mod-tidy:
$(MOD_TIDY)