/
Makefile
55 lines (44 loc) · 1.24 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
# Go related variables.
GOBASE := $(shell pwd)
GOBIN := $(GOBASE)/bin
## build: Run build on examples
build: go-get go-build
## test: Run test suites
test: go-get go-test
## check: Format and lint
check: fmt lint go-tidy
## lint: Run go fmt
fmt:
@echo " > Running go formatter..."
gofmt -w -s ./ 1>&2
## lint: Run linter
lint:
@echo " > Running staticcheck go linter..."
@GOBIN=$(GOBIN) go install honnef.co/go/tools/cmd/staticcheck@latest
@$(GOBIN)/staticcheck -checks all ./...
## lint: Run vet
vet:
@echo " > Running go vet..."
go vet ./...
go-test:
@echo " > Run tests..."
@GOBIN=$(GOBIN) go install github.com/onsi/ginkgo/ginkgo@v1.16.4
@$(GOBIN)/ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace --cover -gcflags="-l" 1>&2
go-get:
@echo " > Checking if there is any missing dependencies..."
go get ./...
go-tidy:
@echo " > Running go mod tidy"
go mod tidy
go-build:
@echo " > Building examples binaries..."
@GOBIN=$(GOBIN) go build -tags debug $(LDFLAGS) examples/s3_app/s3_app.go
@GOBIN=$(GOBIN) go build -tags debug $(LDFLAGS) examples/sftp_app/sftp_app.go
.PHONY: help
all: help
help: Makefile
@echo
@echo " Choose a command run:"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo