-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (47 loc) · 1.37 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
63
64
.PHONY=fmt
BINARY_NAME=eeyore
GOPATH := $(shell go env GOPATH)
GOBIN ?= $(GOPATH)/bin
PREFIX=~/.local/bin
BUILD_DIR=./build
GO := $(shell command -v go 2> /dev/null)
GOLANGCILINT := $(GOBIN)/golangci-lint
$(GOLANGCILINT):
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.50.0
RICHGO := $(GOBIN)/richgo
$(RICHGO):
@go install github.com/kyoh86/richgo@v0.3.6
GOSEC := $(GOBIN)/gosec
$(GOSEC):
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v2.13.1
GOFUMPT := $(GOBIN)/gofumpt
$(GOFUMPT):
$(GO) install mvdan.cc/gofumpt@v0.1.1
GOCRITIC := $(GOBIN)/gocritic
$(GOCRITIC):
$(GO) install github.com/go-critic/go-critic/cmd/gocritic@v0.6.5
dependencies: $(GOLANGCILINT) $(RICHGO) $(GOSEC) $(GOFUMPT) $(GOCRITIC)
fmt: $(GOFUMPT) $(GOCRITIC)
$(GO) fmt ./...
goimports -w .
$(GOFUMPT) -s -w .
$(GOCRITIC) check ./...
lint: $(GOLANGCILINT)
golangci-lint run
test: $(RICHGO)
@$(RICHGO) test -v ./...
security: $(GOSEC)
gosec -quiet ./...
check: dependencies
pre-commit run -a
build:
mkdir -p $(BUILD_DIR)
go build -o $(BUILD_DIR)/$(BINARY_NAME) main.go
install:
test -f $(BUILD_DIR)/$(BINARY_NAME)
mkdir -p $(PREFIX)
cp $(BUILD_DIR)/$(BINARY_NAME) $(PREFIX)
uninstall:
rm $(PREFIX)/$(BINARY_NAME)
clean:
@rm -rf $(BUILD_DIR)