-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
42 lines (33 loc) · 825 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
.ONESHELL:
SHELL := /bin/bash
GOBIN ?= $(GOPATH)/bin
MODULE = github.com/howardjohn/kubectl-resources
export GO111MODULE ?= on
all: format lint install
$(GOBIN)/goimports:
(cd /tmp; go get golang.org/x/tools/cmd/[email protected])
$(GOBIN)/golangci-lint:
(cd /tmp; go get github.com/golangci/golangci-lint/cmd/[email protected])
.PHONY: deps
deps: $(GOBIN)/goimports $(GOBIN)/golangci-lint
.PHONY: check-git
check-git:
@
if [[ -n $$(git status --porcelain) ]]; then
echo "Error: git is not clean"
git status
git diff
exit 1
fi
.PHONY: gen-check
gen-check: check-git format
.PHONY: format
format: $(GOBIN)/goimports
@go mod tidy
@goimports -l -w -local $(MODULE) .
.PHONY: lint
lint: $(GOBIN)/golangci-lint
@golangci-lint run --fix
.PHONY: install
install:
@go install