forked from gruntwork-io/terragrunt
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (52 loc) · 2.15 KB
/
Makefile
File metadata and controls
67 lines (52 loc) · 2.15 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
help:
@echo "Various utilities for managing the terragrunt repository"
fmt:
@echo "Running source files through gofmt..."
gofmt -w $(GOFMT_FILES)
fmtcheck:
pre-commit run goimports --all-files
install-pre-commit-hook:
pre-commit install
# This build target just for convenience for those building directly from
# source. See also: .github/workflows/build.yml
build: terragrunt
terragrunt: $(shell find . \( -type d -name 'vendor' -prune \) \
-o \( -type f -name '*.go' -print \) )
set -xe ;\
vtag_maybe_extra=$$(git describe --tags --abbrev=12 --dirty --broken) ;\
CGO_ENABLED=0 go build -o $@ -ldflags "-s -w -X github.com/gruntwork-io/go-commons/version.Version=$${vtag_maybe_extra}" .
clean:
rm -f terragrunt
IGNORE_TAGS := windows|linux|darwin|freebsd|openbsd|netbsd|dragonfly|solaris|plan9|js|wasip1|aix|android|illumos|ios|386|amd64|arm|arm64|mips|mips64|mips64le|mipsle|ppc64|ppc64le|riscv64|s390x|wasm
LINT_TAGS := $(shell grep -rh --include='*.go' 'go:build' . | \
sed 's/.*go:build\s*//' | \
tr -cs '[:alnum:]_' '\n' | \
grep -vE '^($(IGNORE_TAGS))$$' | \
sed '/^$$/d' | \
sort -u | \
paste -sd, -)
run-lint:
@echo "Linting with feature flags: [$(LINT_TAGS)]"
GOFLAGS="-tags=$(LINT_TAGS)" golangci-lint run -v --timeout=30m ./...
run-lint-incremental:
@echo "Incremental lint (new issues only) with feature flags: [$(LINT_TAGS)]"
GOFLAGS="-tags=$(LINT_TAGS)" golangci-lint run -v --timeout=30m --new-from-merge-base=main ./...
run-lint-fix:
@echo "Linting with feature flags: [$(LINT_TAGS)]"
GOFLAGS="-tags=$(LINT_TAGS)" golangci-lint run -v --timeout=30m --fix ./...
generate-mocks:
go generate ./...
license-check:
go mod vendor
licensei cache --debug
licensei check --debug
licensei header --debug
fuzz:
@for package in $$(go list ./...); do \
for fuzz_test in $$(go test -list 'Fuzz' "$$package" 2>/dev/null | grep '^Fuzz' || true); do \
echo "Fuzzing $$fuzz_test in $$package"; \
go test -run '^$$' -fuzztime="30s" -v -fuzz "^$$fuzz_test$$" "$$package"; \
done; \
done
.PHONY: help fmt fmtcheck install-pre-commit-hook clean run-lint run-lint-fix fuzz