-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (41 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
43
44
45
46
47
48
49
50
51
52
53
54
include ./Makefile.Common
#RULES
$(TOOLS_DIR):
mkdir -p $@
.PHONY: check-fmt
ensure-fmt: fmt
@git diff -s --exit-code *.go || (echo "Build failed: a go file is not formated correctly. Run 'make fmt' and update your PR." && exit 1)
.PHONY: gofmt
gofmt:
go fmt ./...
.PHONY: govet
govet:
go vet ./...
.PHONY: compilecheck
compilecheck:
$(GO_ENV)
go build -v ./...
.PHONY: gotest
test: gofmt govet ensure-fmt
CGO_ENABLED=0 go test -v ./... -failfast
.PHONY: gomoddownload
gomoddownload:
go mod download -x
.PHONY: install-gotools
install-gotools: $(TOOLS_DIR)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_DIR) $(GOLINT_VERSION)
.PHONY: golint
golint:
$(LINT) run --verbose --allow-parallel-runners --timeout=10m
.PHONY: gotidy
gotidy:
go mod tidy -compat=1.21
.PHONY: build
build:
go build -o bin/guestbook cmd/server/main.go
.PHONY: run
run: gofmt build
./bin/main
.PHONY: gorun
gorun:
go run cmd/server/main.go