-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (33 loc) · 1005 Bytes
/
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
SRCS = $(shell git ls-files '*.go' | grep -v '^vendor/')
mod:
go mod tidy
.PHONY: mod
test: mod
go test ./...
.PHONY: test
## Format the Code.
fmt:
// gofmt -s -l -w $(SRCS)
gofumpt -s -l -w $(SRCS)
.PHONY: fmt
## Lint the Code.
lint: mod
golangci-lint run -v --out-format=tab --timeout 10m0s
.PHONY: lint
## Install tools
tools:
go install github.com/mvdan/gofumpt@latest
go install github.com/goreleaser/goreleaser@latest
if [[ "$$OSTYPE" == "darwin"* ]]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.43.0; fi
if [[ "$$OSTYPE" == "linux-gnu"* ]]; then wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.43.0; fi
.PHONY: tools
pre-commit:
pip3 install pre-commit
pre-commit install
.PHONY: pre-commit
release:
goreleaser release --rm-dist
.PHONY: release
snapshot: .goreleaser.yml tools/goreleaser
goreleaser --snapshot --rm-dist
.PHONY: snapshot