-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (43 loc) · 759 Bytes
/
Copy pathMakefile
File metadata and controls
55 lines (43 loc) · 759 Bytes
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
BINARY := geo-decoding-server
IMAGE ?= lychee-geo-decoding
PORT ?= 8080
.PHONY: all
all: build vet fmt-check test
.PHONY: build
build:
go build -o $(BINARY) .
.PHONY: run
run: build
./$(BINARY)
.PHONY: test
test:
go test ./...
.PHONY: test-race
test-race:
go test -race ./...
.PHONY: vet
vet:
go vet ./...
.PHONY: fmt
fmt:
gofmt -w .
.PHONY: fmt-check
fmt-check:
@fmt_out="$$(gofmt -l .)"; \
if [ -n "$$fmt_out" ]; then \
echo "The following files are not gofmt-formatted:"; \
echo "$$fmt_out"; \
exit 1; \
fi
.PHONY: tidy
tidy:
go mod tidy
.PHONY: docker-build
docker-build:
docker build -t $(IMAGE) .
.PHONY: docker-run
docker-run: docker-build
docker run --rm -p $(PORT):8080 $(IMAGE)
.PHONY: clean
clean:
rm -f $(BINARY)