-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
44 lines (36 loc) · 1.33 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
.DEFAULT_GOAL := build
.PHONY: build
build:
CGO_ENABLED=0 go build -buildvcs=false -trimpath -o rss_fetcher ./cmd/rss_fetcher
CGO_ENABLED=0 go build -buildvcs=false -trimpath -o db_printer ./cmd/db_printer
.PHONY: linux
linux: protoc update test
GOOS=linux GOARCH=amd64 go build -buildvcs=false -trimpath .
.PHONY: test
test:
go test -v -race ./...
.PHONY: update
update: protoc
go get -u ./...
go mod tidy -v
.PHONY: lint
lint:
"$$(go env GOPATH)/bin/golangci-lint" run ./...
go mod tidy
.PHONY: lint-update
lint-update:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin
$$(go env GOPATH)/bin/golangci-lint --version
.PHONY: install-protoc
install-protoc:
mkdir -p /tmp/protoc
curl -s -L https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | jq '.assets[] | select(.name | endswith("-linux-x86_64.zip")) | .browser_download_url' | xargs curl -s -L -o /tmp/protoc/protoc.zip
unzip -d /tmp/protoc/ /tmp/protoc/protoc.zip
sudo mv /tmp/protoc/bin/protoc /usr/bin/protoc
sudo rm -rf /usr/local/include/google
sudo mv /tmp/protoc/include/* /usr/local/include
rm -rf /tmp/protoc
.PHONY: protoc
protoc: install-protoc
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
protoc -I ./proto -I /usr/local/include/ ./proto/rss.proto --go_out=.