-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
81 lines (64 loc) · 1.63 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
.EXPORT_ALL_VARIABLES:
# Docker images
DOCKER_IMAGE_GOLANG = golang:1.23-alpine3.20
DOCKER_IMAGE_BUF = bufbuild/buf:1.45.0
default: build
.PHONY: tools
tools: ./bin/golangci-lint $(GOPATH)/bin/esc $(GOPATH)/bin/gothanks
.PHONY: deps
deps:
go mod download
.PHONY: protobuf
protobuf:
@echo "🖋 Generating proto..."
@docker run --rm \
-v `pwd`:/proto \
-w /proto \
${DOCKER_IMAGE_BUF} \
generate --verbose
.PHONY: check
check: tools
./bin/golangci-lint run ./...
.PHONY: thanks
thanks: tools
$(GOPATH)/bin/gothanks -y | grep -v "is already"
.PHONY: build
build:
go build -o playground-protoactor .
.PHONY: lint
lint: lint-proto
.PHONY: lint-proto
lint-proto:
@echo "🖋 Linting proto..."
@docker run --rm \
-v `pwd`:/work \
-w /work \
${DOCKER_IMAGE_BUF} \
lint
.PHONY: format
format: format-go
format-go:
@echo "📐 Formatting go source code..."
@docker run --rm \
-v `pwd`:/work:rw \
-w /work \
${DOCKER_IMAGE_GOLANG} \
sh -c \
"go install mvdan.cc/[email protected]; gofumpt -w -l ."
.PHONY: docker
docker:
@echo "📦 building container"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o playground-protoactor.amd64 .
docker build .
$(GOPATH)/bin/gothanks:
@echo "📦 installing $(notdir $@)"
go get -u github.com/psampaz/gothanks
$(GOPATH)/bin/esc:
@echo "📦 installing $(notdir $@)"
go get -u github.com/mjibson/esc
$(GOPATH)/bin/protoc:
@echo "📦 installing $(notdir $@)"
go get -u google.golang.org/protobuf/cmd/protoc-gen-go
./bin/golangci-lint:
@echo "📦 installing $(notdir $@)"
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.32.2