-
-
Notifications
You must be signed in to change notification settings - Fork 996
/
Makefile
56 lines (42 loc) · 1.8 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
# Some of the targets in this file were taken from the terraform project:
# https://github.com/hashicorp/terraform/blob/master/scripts/gofmtcheck.sh
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
help:
@echo "Various utilities for managing the terragrunt repository"
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
fmt:
@echo "Running source files through gofmt..."
gofmt -w $(GOFMT_FILES)
install-pre-commit-hook:
@if [ -f .git/hooks/pre-commit -o -L .git/hooks/pre-commit ]; then \
echo ""; \
echo "There is already a pre-commit hook installed. Remove it and run 'make"; \
echo "install-pre-commit-hook again, or manually alter it to add the contents"; \
echo "of 'scripts/pre-commit'."; \
echo ""; \
exit 1; \
fi
@ln -s scripts/pre-commit .git/hooks/pre-commit
@echo "pre-commit hook installed."
# This build target just for convenience for those building directly from
# source. See also: .circleci/config.yml
build: terragrunt
terragrunt: $(shell find . \( -type d -name 'vendor' -prune \) \
-o \( -type f -name '*.go' -print \) ) install-mockery generate-mocks
set -xe ;\
vtag_maybe_extra=$$(git describe --tags --abbrev=12 --dirty --broken) ;\
go build -o $@ -ldflags "-X github.com/gruntwork-io/go-commons/version.Version=$${vtag_maybe_extra} -extldflags '-static'" .
clean:
rm -f terragrunt
install-lint:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
run-lint:
golangci-lint run -v --timeout=10m ./...
run-strict-lint:
golangci-lint run -v --timeout=10m -c .strict.golangci.yml --new-from-rev origin/main ./...
install-mockery:
go install github.com/vektra/mockery/v2@v2.44.1
generate-mocks:
go generate ./...
.PHONY: help fmtcheck fmt install-fmt-hook clean install-lint run-lint run-strict-lint