forked from bitnami/render-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vars.mk
25 lines (19 loc) · 740 Bytes
/
vars.mk
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
SHELL := /bin/bash
GOPATH ?= $(shell go env GOPATH)
PATH := $(GOPATH)/bin:$(PATH)
BUILD_DIR := $(abspath ./out)
TOOL_NAME ?= $(shell basename $(CURDIR))
TOOL_PATH ?= $(BUILD_DIR)/$(TOOL_NAME)
BUILD_DATE := $(shell date -u '+%Y-%m-%d %I:%M:%S UTC' 2> /dev/null)
GIT_HASH := $(shell git rev-parse HEAD 2> /dev/null)
LDFLAGS="'main.buildDate=$(BUILD_DATE)' -X main.commit=$(GIT_HASH) -s -w"
DEBUG ?= 0
ifeq ($(DEBUG),1)
GO_TEST := @go test -v
else
GO_TEST := @go test
endif
GO_MOD := @go mod
# Do not do goimport of the vendor dir
go_files=$$(find $(1) -type f -name '*.go' -not -path "./vendor/*")
fmtcheck = @if goimports -l $(go_files) | read var; then echo "goimports check failed for $(1):\n `goimports -d $(go_files)`"; exit 1; fi