-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (65 loc) · 1.89 KB
/
Makefile
File metadata and controls
81 lines (65 loc) · 1.89 KB
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
GOLANGCI_VERSION = 1.52.2
SRC = $(shell find . -name *.go)
GO = go
all: extkey
extkey: $(SRC)
$(GO) build -o build/extkey ./cmd/extkey
.PHONY: test
test:
$(GO) test -mod=readonly -race ./...
install: test
$(GO) install ./cmd/extkey
.PHONY: docker
docker:
docker build -f docker/Dockerfile -t figuretechnologies/extkey .
.PHONY: clean
clean:
rm -f extkey
###########
# Linting #
###########
LINTER := $(shell command -v golangci-lint 2> /dev/null)
MISSPELL := $(shell command -v misspell 2> /dev/null)
GOIMPORTS := $(shell command -v goimports 2> /dev/null)
.PHONY: gofmt
gofmt:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs gofmt -s -w
.PHONY: check-goimports
check-goimports:
ifndef GOIMPORTS
echo "Fetching goimports"
go install golang.org/x/tools/cmd/goimports
endif
.PHONY: goimports
goimports: check-goimports
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/FigureTechnologies/extkey
.PHONY: check-gomisspell
check-gomisspell:
ifndef MISSPELL
echo "Fetching misspell"
go install github.com/client9/misspell/cmd/misspell
endif
.PHONY: gomisspell
gomisspell: check-gomisspell
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs misspell -w
.PHONY: check-lint
check-lint:
ifndef LINTER
echo "Fetching golangci-lint"
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(GOLANGCI_VERSION)
endif
.PHONY: lint
lint: check-lint goimports gofmt gomisspell
golangci-lint run
############
# Protobuf #
############
.PHONY: proto
proto:
mkdir -p `pwd`/pkg/encryption/eckey && \
docker run --rm \
-v `pwd`/proto:/proto \
-v `pwd`/pkg/encryption/eckey:/build:rw \
-w='/' \
--entrypoint=protoc \
namely/protoc -I./proto -I/opt/include --gogo_out=./build --gogo_opt=paths=source_relative eckey.proto