-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (40 loc) · 1.12 KB
/
Makefile
File metadata and controls
52 lines (40 loc) · 1.12 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
47
48
49
50
51
52
.PHONY: default
default: build lint test
.PHONY: build
build:
go build -o /dev/null .
TEST_OPTS=
.PHONY: test
test:
go test $(TEST_OPTS) ./...
GOLANG_TOOL_GOBIN=$(shell go env GOBIN)
GOLANG_TOOL_GOPATH=$(shell go env GOPATH)
ifneq ($(GOLANG_TOOL_GOBIN),)
GOLANG_TOOL_PATH_TO_BIN=$(GOLANG_TOOL_GOBIN)
else
GOLANG_TOOL_PATH_TO_BIN=$(GOLANG_TOOL_GOPATH)/bin
endif
GOLANGCI_LINT_VERSION=v2.7.2
GOLANGCI_LINT = $(GOLANG_TOOL_PATH_TO_BIN)/golangci-lint
$(GOLANGCI_LINT):
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
.PHONY: lint
lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT) run ./...
VERSION_FILE=version.go
VERSION = $(shell cat $(VERSION_FILE) | grep 'const Version' | cut -d '"' -f 2)
.PHONY: version
version:
@echo $(VERSION)
VERSION_TAG_NAME = v$(VERSION)
.PHONY: tag_push
tag_push:
git tag $(VERSION_TAG_NAME)
git push origin $(VERSION_TAG_NAME)
TEXT_TEMPLATE_CLI=$(shell go env GOPATH)/bin/text-template-cli
$(TEXT_TEMPLATE_CLI):
go install github.com/akm/text-template-cli@latest
README.md: README-gen
.PHONY: README-gen
README-gen:
$(TEXT_TEMPLATE_CLI) README.md.tmpl > README.md