-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (46 loc) · 1.69 KB
/
Copy pathMakefile
File metadata and controls
59 lines (46 loc) · 1.69 KB
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
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS = -s -w \
-X github.com/sadopc/gottp/pkg/version.Version=$(VERSION) \
-X github.com/sadopc/gottp/pkg/version.Commit=$(COMMIT) \
-X github.com/sadopc/gottp/pkg/version.Date=$(DATE)
.PHONY: build run test test-race test-cover lint clean install release-dry-run vulncheck fuzz bench
build:
@mkdir -p bin
go build -ldflags "$(LDFLAGS)" -o bin/gottp ./cmd/gottp
run: build
./bin/gottp
test:
go test ./...
test-race:
go test -race ./...
test-cover:
go test -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -func=coverage.out | tail -1
@echo "HTML report: go tool cover -html=coverage.out"
lint:
golangci-lint run
vulncheck:
govulncheck ./...
fuzz:
@echo "Fuzzing cURL parser..."
-go test -fuzz=Fuzz -fuzztime=30s ./internal/import/curl/
@echo "Fuzzing Postman parser..."
-go test -fuzz=Fuzz -fuzztime=30s ./internal/import/postman/
@echo "Fuzzing Insomnia parser..."
-go test -fuzz=Fuzz -fuzztime=30s ./internal/import/insomnia/
@echo "Fuzzing OpenAPI parser..."
-go test -fuzz=Fuzz -fuzztime=30s ./internal/import/openapi/
@echo "Fuzzing HAR parser..."
-go test -fuzz=Fuzz -fuzztime=30s ./internal/import/har/
@echo "Fuzzing format detector..."
-go test -fuzz=Fuzz -fuzztime=30s ./internal/import/
bench:
go test -bench=. -benchmem ./internal/protocol/http/ ./internal/scripting/ ./internal/diff/ ./internal/core/collection/
clean:
rm -rf bin/ coverage.out
install:
go install -ldflags "$(LDFLAGS)" ./cmd/gottp
release-dry-run:
goreleaser release --snapshot --clean