-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (43 loc) · 1.21 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
56
57
.PHONY: all
all: build
NOW := $(shell date -u +'%Y-%m-%dT%TZ')
REVISION := $(shell git rev-parse --short=8 HEAD)
LDFLAGS := "-X main.revision=$(REVISION) -X main.buildTime=$(NOW)"
MAIN_CLI := bin/sql-executor
.PHONY: build
build:
go build -o $(MAIN_CLI) -ldflags $(LDFLAGS) cmd/executor/main.go
.PHONY: modclean
modclean:
go mod tidy
.PHONY: clean
clean:
go clean -testcache
rm -f $(MAIN_CLI)
.PHONY: fmt
fmt:
gofmt -w **/*.go
.PHONY: test
test:
go test -v -race -cover ./...
GOLANGCI_LINT_CLI := bin/golangci-lint
GOLANGCI_LINT_SITE := https://raw.githubusercontent.com
GOLANGCI_LINT_PATH := /golangci/golangci-lint/master/install.sh
GOLANGCI_LINT_VERSION := v1.39.0
$(GOLANGCI_LINT_CLI):
@echo "# install $@ before lint check"
@mkdir -p bin
$(shell curl -sSfL $(GOLANGCI_LINT_SITE)$(GOLANGCI_LINT_PATH) | sh -s $(GOLANGCI_LINT_VERSION))
.PHONY: lint
lint: $(GOLANGCI_LINT_CLI)
./$(GOLANGCI_LINT_CLI) run $(linters)
GOCREDITS := bin/gocredits
$(GOCREDITS):
@echo "# install $@ before creating CREDITS file"
@mkdir -p bin
GOBIN=$(abspath bin) go get -u github.com/Songmu/gocredits/cmd/gocredits
.PHONY: CREDITS
CREDITS: $(GOCREDITS)
@echo "# create CREDITS file"
rm -f $@
$(GOCREDITS) -skip-missing . > $@