-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (43 loc) · 1.12 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
BUILD = $(CURDIR)/build
LINT_FILE = $(CURDIR)/lint.toml
PROJECT_NAME = gh_exporter
GOBIN=$(shell pwd)/bin
help: ## Show help dialog
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
.PHONY: install
install: ## Install dependencies
go get -d github.com/mgechev/revive; \
go get -d github.com/goreleaser/goreleaser
.PHONY: build
build: ## Build the project
go build -o $(BUILD)/$(PROJECT_NAME) $(CURDIR)/cmd/$(PROJECT_NAME)/main.go
.PHONY: cp
cp: ## Copy project to bin
cp $(BUILD)/$(PROJECT_NAME) /usr/local/bin
.PHONY: clean
clean: ## Clean project
go clean; \
rm -rf $(BUILD);
.PHONY: run
run: ## Run project locally
$(BUILD)/$(PROJECT_NAME) -dir ../
.PHONY: fmt
fmt: ## Format project
go fmt $(CURDIR)/...
.PHONY: lint
lint: ## Lint project
revive -config $(LINT_FILE) -formatter friendly $(CURDIR)/...
.PHONY: check
check: ## Format and lint project
check: fmt lint
.PHONY: tidy
tidy: ## Tidy up go modules
tidy:
go mod tidy
.PHONY: release
release: ## Publish package to github
release:
goreleaser release --rm-dist
.PHONY: setup
setup: ## Setup project
setup: clean install tidy