forked from mailchain/mailchain-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (46 loc) · 1.86 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
GO := go
all : build
.PHONY: clean test all
clean:
$(GO) clean
build:
$(GO) build ./...
test: generate unit-test
unit-test:
$(GO) test ./...
license: .FORCE
addlicense -l apache -c Finobo ./internal
proto:
rm -f ./internal/envelope/*.pb.go
protoc ./internal/envelope/data.proto -I. --go_out=:.
.PHONY: go-generate
go-generate:
go generate ./...
.PHONY: generate
generate: go-generate license
openapi:
go mod vendor
rm -rf vendor/github.com/ethereum
docker run --rm -i \
-e GOPATH=/go \
-v $(CURDIR):/go/src/github.com/mailchain/mailchain \
-w /go/src/github.com/mailchain/mailchain \
mailchain/goswagger-tool swagger generate spec -b ./cmd/mailchain/internal/http/handlers -o ./docs/openapi/spec.json
echo "" >> ./docs/openapi/spec.json
echo "package handlers" > ./cmd/mailchain/internal/http/handlers/openapi.go
echo "" >> ./cmd/mailchain/internal/http/handlers/openapi.go
echo "//nolint: gofmt" >> ./cmd/mailchain/internal/http/handlers/openapi.go
echo "//nolint: lll" >> ./cmd/mailchain/internal/http/handlers/openapi.go
echo "//nolint: funlen" >> ./cmd/mailchain/internal/http/handlers/openapi.go
echo 'func spec() string {' >> ./cmd/mailchain/internal/http/handlers/openapi.go
echo ' return `' >> ./cmd/mailchain/internal/http/handlers/openapi.go
cat ./docs/openapi/spec.json | sed 's/`/¬/g' >> ./cmd/mailchain/internal/http/handlers/openapi.go
echo '`' >> ./cmd/mailchain/internal/http/handlers/openapi.go
echo '}' >> ./cmd/mailchain/internal/http/handlers/openapi.go
addlicense -l apache -c Finobo ./cmd/mailchain/internal/http/handlers/openapi.go
rm -rf vendor
snapshot:
docker run --rm --privileged -v $(CURDIR):/go/src/github.com/mailchain/mailchain -v /var/run/docker.sock:/var/run/docker.sock -w /go/src/github.com/mailchain/mailchain mailchain/goreleaser-xcgo goreleaser --snapshot --rm-dist
lint:
golangci-lint run --fix
.FORCE: