-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
61 lines (44 loc) · 1.52 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
.DEFAULT_GOAL := build
BUILD_DATE = `date +%FT%T%z`
GO = go
BINARY_DIR=bin
GODIRS_NOVENDOR = $(shell go list ./... | grep -v /vendor/)
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
BUILD_INFO_LDFLAGS=-ldflags "-extldflags '"-static"' -X main.buildDate=${BUILD_DATE} -X main.version=${v}"
.PHONY: test build
help:
@echo "build - go build"
@echo "test - go test"
@echo "checkstyle - gofmt+golint+misspell"
init-deps:
# installs gometalinter
# curl -L https://git.io/vp6lP | sh
# gometalinter --install
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.31.0
#vendor:
# dep ensure --vendor-only
test:
$(GO) test -cover ${GODIRS_NOVENDOR}
lint:
golangci-lint run --enable-all --deadline 10m ./...
fmt:
gofumpt -extra -l -w -s ${GOFILES_NOVENDOR}
gofumports -local -l -w ${GOFILES_NOVENDOR}
gci -local github.com/avarabyeu/goRP/v5 -w ${GOFILES_NOVENDOR}
#build: checkstyle test
build:
$(GO) build ${BUILD_INFO_LDFLAGS} -o ${BINARY_DIR}/gorp ./
cross-build:
gox ${BUILD_INFO_LDFLAGS} -arch="amd64 386" -os="linux windows darwin" -output="dist/{{.Dir}}_{{.OS}}_{{.Arch}}"
clean:
if [ -d ${BINARY_DIR} ] ; then rm -r ${BINARY_DIR} ; fi
if [ -d 'build' ] ; then rm -r 'build' ; fi
tag:
git tag -a v${v} -m "creating tag ${v}"
git push origin "refs/tags/v${v}"
release:
rm -rf dist
goreleaser release
grpc-gen:
#Learn here: https://jbrandhorst.com/post/go-protobuf-tips/
protoc -I=. -I=vendor -I=${GOPATH}/src model/*.proto --go_out=plugins=grpc:.