-
Notifications
You must be signed in to change notification settings - Fork 56
/
Makefile
58 lines (43 loc) · 1.23 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
# Copyright (c) Microsoft Corporation.
# Licensed under the Apache v2.0 license.
GOCMD=GO111MODULE=on GOARCH=amd64 go
GOBUILD=$(GOCMD) build -v #-mod=vendor
GOTEST=$(GOCMD) test -v
GOHOSTOS=$(strip $(shell $(GOCMD) env get GOHOSTOS))
MOCKGEN=$(shell command -v mockgen 2> /dev/null)
GOPATH_BIN := $(shell go env GOPATH)/bin
# Private repo workaround
export GOPRIVATE = github.com/microsoft
# Active module mode, as we use go modules to manage dependencies
export GO111MODULE=on
#
PKG :=
all: format test
.PHONY: tidy
tidy:
go mod tidy
format:
gofmt -s -w rpc/ pkg/
bootstrap:
GOOS="linux" go get -u google.golang.org/[email protected]
GOOS="linux" go install github.com/golang/protobuf/[email protected]
test: unittest
unittest:
$(GOTEST) ./pkg/...
generate: bootstrap
(./gen.sh)
pipeline: bootstrap
(./gen.sh -c)
## Install mockgen golang bin
install-mockgen:
ifeq ($(MOCKGEN),)
go install github.com/golang/mock/[email protected]
endif
MOCKGEN=$(shell command -v mockgen 2> /dev/null)
mocks:
go mod download github.com/golang/mock
go get github.com/golang/[email protected]
go generate ./...
golangci-lint:
$(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
$(GOPATH_BIN)/golangci-lint run --config .golangci.yml