-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
31 lines (24 loc) · 908 Bytes
/
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
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
.PHONY: fmt
fmt: gofumpt ## Run gofumt against code.
go mod tidy -compat=1.23
$(GOFUMPT) -w -extra .
.PHONY: vendor
vendor:
go mod vendor
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
.PHONY: lint
lint:
test -s $(GOLANGCI_LINT) || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(LOCALBIN)
CGO_ENABLED=0 $(GOLANGCI_LINT) run --timeout 5m
GOFUMPT ?= $(LOCALBIN)/gofumpt
.PHONY: gofumpt
gofumpt: $(GOFUMPT) ## Download gofumpt locally if necessary.
$(GOFUMPT): $(LOCALBIN)
test -s $(LOCALBIN)/gofumpt || GOBIN=$(LOCALBIN) go install mvdan.cc/gofumpt@latest
.PHONY: build
build: ## Run go build against code.
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -tags timetzdata -tags=nomsgpack -o $(LOCALBIN)/hetzner-dnsapi-proxy .