This repository was archived by the owner on Jan 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (50 loc) · 1.41 KB
/
Makefile
File metadata and controls
63 lines (50 loc) · 1.41 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
TOOLS_DIR := tools
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
all: build
fmt: ## Run go fmt against code.
go fmt ./...
vet: ## Run go vet against code.
go vet ./...
build: fmt vet ## Build manager binary.
go build -o bin/backend main.go
run: fmt vet ## Run code from your host.
go run ./main.go
test:
go test ./... -coverprofile cover.out
IMG ?= tjcadworkflow/backend
docker-build:
docker buildx build -t ${IMG} . --load
docker-push:
docker buildx build --platform linux/amd64,linux/arm64 -t ${IMG} . --push
# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef
install-golint: ## check golint if not exist install golint tools
ifeq (, $(shell which golangci-lint))
@{ \
set -e ;\
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1 ;\
}
GOLINT_BIN=$(shell go env GOPATH)/bin/golangci-lint
else
GOLINT_BIN=$(shell which golangci-lint)
endif
lint: install-golint ## Run go lint against code.
$(GOLINT_BIN) run -v
fake-frontend:
$(MAKE) -C $(TOOLS_DIR)/fake-frontend run