forked from RedHatInsights/insights-operator-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (57 loc) · 2.04 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
.PHONY: help clean build fmt lint vet run test style cyclo license godoc install_docgo install_addlicense
SOURCES:=$(shell find . -name '*.go')
DOCFILES:=$(addprefix docs/packages/, $(addsuffix .html, $(basename ${SOURCES})))
fmt: ## Run go fmt -w for all sources
@echo "Running go formatting"
./gofmt.sh
lint: ## Run golint
@echo "Running go lint"
./golint.sh
vet: ## Run go vet. Report likely mistakes in source code
@echo "Running go vet"
./govet.sh
cyclo: ## Run gocyclo
@echo "Running gocyclo"
./gocyclo.sh
ineffassign: ## Run ineffassign checker
@echo "Running ineffassign checker"
./ineffassign.sh
shellcheck: ## Run shellcheck
shellcheck *.sh
errcheck: ## Run errcheck
@echo "Running errcheck"
./goerrcheck.sh
goconst: ## Run goconst checker
@echo "Running goconst checker"
./goconst.sh
gosec: ## Run gosec checker
@echo "Running gosec checker"
./gosec.sh
abcgo: ## Run ABC metrics checker
@echo "Run ABC metrics checker"
./abcgo.sh
style: fmt vet lint cyclo shellcheck errcheck goconst gosec ineffassign abcgo ## Run all the formatting related commands (fmt, vet, lint, cyclo) + check shell scripts
test: clean build ## Run the unit tests
@go test -coverprofile coverage.out $(shell go list ./...)
help: ## Show this help screen
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
@echo ''
@echo 'Available targets are:'
@echo ''
@grep -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@echo ''
license: install_addlicense
addlicense -c "Red Hat, Inc" -l "apache" -v ./
docs/packages/%.html: %.go
mkdir -p $(dir $@)
docgo -outdir $(dir $@) $^
addlicense -c "Red Hat, Inc" -l "apache" -v $@
godoc: export GO111MODULE=off
godoc: install_docgo install_addlicense ${DOCFILES}
install_docgo: export GO111MODULE=off
install_docgo:
[[ `command -v docgo` ]] || GO111MODULE=off go get -u github.com/dhconnelly/docgo
install_addlicense: export GO111MODULE=off
install_addlicense:
[[ `command -v addlicense` ]] || GO111MODULE=off go get -u github.com/google/addlicense