forked from celestiaorg/go-fraud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (52 loc) · 1.97 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
SHELL=/usr/bin/env bash
PROJECTNAME=$(shell basename "$(PWD)")
LDFLAGS=-ldflags="-X 'main.buildTime=$(shell date)' -X 'main.lastCommit=$(shell git rev-parse HEAD)' -X 'main.semanticVersion=$(shell git describe --tags --dirty=-dev)'"
ifeq (${PREFIX},)
PREFIX := /usr/local
endif
## help: Get more info on make commands.
help: Makefile
@echo " Choose a command run in "$(PROJECTNAME)":"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
.PHONY: help
## install-hooks: Install git-hooks from .githooks directory.
install-hooks:
@echo "--> Installing git hooks"
@git config core.hooksPath .githooks
.PHONY: install-hooks
## cover: generate to code coverage report.
cover:
@echo "--> Generating Code Coverage"
@go install github.com/ory/go-acc@latest
@go-acc -o coverage.txt `go list ./... | grep -v nodebuilder/tests` -- -v
.PHONY: cover
## deps: install dependencies.
deps:
@echo "--> Installing Dependencies"
@go mod download
.PHONY: deps
## fmt: Formats only *.go (excluding *.pb.go *pb_test.go). Runs `gofmt & goimports` internally.
fmt:
@find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s
@find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs goimports -w -local github.com/celestiaorg
@go mod tidy -compat=1.17
@gofumpt -w -extra .
@cfmt -w -m=100 ./...
.PHONY: fmt
## lint: Linting *.go files using golangci-lint. Look for .golangci.yml for the list of linters. Also lint *.md files using markdownlint.
lint:
@echo "--> Running linter"
@yamllint --no-warnings .
@golangci-lint run
@cfmt -m=100 ./...
.PHONY: lint
## test: Running unit tests
test:
@echo "--> Running unit tests"
@go test -race -covermode=atomic -coverprofile=coverage.txt `go list ./... | grep -v nodebuilder/tests`
.PHONY: test
## benchmark: Running all benchmarks
benchmark:
@echo "--> Running benchmarks"
@go test -run="none" -bench=. -benchtime=100x -benchmem ./...
.PHONY: benchmark