forked from ntv-one/rport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (48 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
61
62
.PHONY: all
# Go parameters
BINARIES=rport rportd
all: test build lint
build:
CGO_ENABLED=0 $(foreach BINARY,$(BINARIES),go build -ldflags "-s -w" -o $(BINARY) -v ./cmd/$(BINARY)/...;)
build-debug:
$(foreach BINARY,$(BINARIES),go build -race -gcflags "all=-N -l" -o $(BINARY) -v ./cmd/$(BINARY)/...;)
test:
go test -race -v ./...
bind-data:
cd db/migration/jobs/sql/ && go-bindata -o ../bindata.go -pkg jobs ./...
cd db/migration/clients/sql/ && go-bindata -o ../bindata.go -pkg clients ./...
cd db/migration/client_groups/sql/ && go-bindata -o ../bindata.go -pkg client_groups ./...
cd db/migration/vaults/sql/ && go-bindata -o ../bindata.go -pkg vaults ./...
cd db/migration/library/sql/ && go-bindata -o ../bindata.go -pkg library ./...
cd db/migration/auditlog/sql/ && go-bindata -o ../bindata.go -pkg auditlog ./...
cd db/migration/monitoring/sql/ && go-bindata -o ../bindata.go -pkg monitoring ./...
cd db/migration/api_sessions/sql/ && go-bindata -o ../bindata.go -pkg api_sessions ./...
cd db/migration/api_token/sql/ && go-bindata -o ../bindata.go -pkg api_token ./...
# usage: make bindata-db DB=monitoring, if you want to generate embedded file for monitoring.db migration
bindata-db:
cd db/migration/$(DB)/sql/ && go-bindata -o ../bindata.go -pkg $(DB) ./...
clean:
go clean
rm -f $(BINARIES)
goreleaser-rm-dist:
goreleaser --rm-dist
goreleaser-snapshot:
goreleaser --snapshot --rm-dist
docker-goreleaser:
docker run -it --rm --privileged \
-v ${PWD}:${PWD} \
-v $(shell go env GOCACHE):/cache/go \
-e GOCACHE=/cache/go \
-v /var/run/docker.sock:/var/run/docker.sock \
-w ${PWD} \
goreleaser/goreleaser:latest --snapshot --rm-dist --skip-publish
docker-golangci-lint:
docker run -it --rm \
-v ${PWD}:${PWD} \
-w ${PWD} \
golangci/golangci-lint:v1.45 golangci-lint -c .golangci.yml run
fmt:
goimports -w .
gofmt -w .
lint:
golangci-lint run