-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
47 lines (33 loc) · 923 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
.PHONY: all build install clean fmt lint test docker-build docker-push
USERNAME := jonesrussell
PROJECTNAME := page-prowler
VERSION := v1.0.0
GO = go
GO_LDFLAGS = -ldflags "-s -w"
BINARY_DIR = bin
BINARY_NAME = page-prowler
all: fmt lint generate test build
build:
$(GO) build $(GO_LDFLAGS) -o $(BINARY_DIR)/$(BINARY_NAME) main.go
install: build
install -D -m 0755 $(BINARY_DIR)/$(BINARY_NAME) $(DESTDIR)$(PREFIX)/bin/
clean:
rm -f $(BINARY_DIR)/$(BINARY_NAME)
fmt:
$(GO) fmt ./...
lint:
golangci-lint run
vet:
$(GO) vet ./...
test:
$(GO) test -v -race ./... -cover
tidy:
$(GO) mod tidy
profile:
$(GO) test -cpuprofile cpu.pprof -memprofile mem.pprof -bench .
docker-build:
docker build -t $(USERNAME)/$(PROJECTNAME):$(VERSION) .
docker-push:
docker push $(USERNAME)/$(PROJECTNAME):$(VERSION)
generate:
go run github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen api.yaml > internal/api/api.gen.go