-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
37 lines (33 loc) · 798 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
# Run go fmt against code
.PHONY: fmt
fmt:
@find . -type f -name '*.go'| grep -v "/vendor/" | xargs gofmt -w -s
# Run golang lint against code
.PHONY: lint
lint: golangci-lint
@$(GOLANG_LINT) --version
@$(GOLANG_LINT) run
# Run mod tidy against code
.PHONY: tidy
tidy:
@go mod tidy
# find or install golangci-lint if necessary
golangci-lint:
ifeq (, $(shell which golangci-lint))
@{ \
set -e ;\
export GO111MODULE=on; \
GOLANG_LINT_TMP_DIR=$$(mktemp -d) ;\
cd $$GOLANG_LINT_TMP_DIR ;\
go mod init tmp ;\
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 ;\
rm -rf $$GOLANG_LINT_TMP_DIR ;\
}
GOLANG_LINT=$(shell go env GOPATH)/bin/golangci-lint
else
GOLANG_LINT=$(shell which golangci-lint)
endif
# Verify all changes
.PHONY: verify
verify:
hack/verify-all.sh