Debian Codegraph @

Makefile

raw
1 ROOT := github.com/mfridman/tparse
2 GOPATH ?= $(shell go env GOPATH)
3 TOOLS_BIN = $(GOPATH)/bin
4
5 .PHONY: vet
6 vet:
7 @go vet ./...
8
9 .PHONY: lint
10 lint: tools
11 @golangci-lint run ./... --fix
12
13 .PHONY: tools
14 tools:
15 @which golangci-lint >/dev/null 2>&1 || \
16 (echo "Installing latest golangci-lint" && \
17 curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
18 sh -s -- -b "$(TOOLS_BIN)")
19
20 .PHONY: tools-update
21 tools-update:
22 @echo "Updating golangci-lint to latest version"
23 @rm -f "$(TOOLS_BIN)/golangci-lint"
24 @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
25 sh -s -- -b "$(TOOLS_BIN)"
26 @echo "golangci-lint updated successfully to latest version"
27
28 .PHONY: tools-version
29 tools-version:
30 @echo "Current tool versions:"
31 @echo "golangci-lint: $$(golangci-lint --version 2>/dev/null || echo 'not installed')"
32
33 .PHONY: release
34 release:
35 @goreleaser --rm-dist
36
37 .PHONY: build
38 build:
39 @go build -o $$GOBIN/tparse ./
40
41 .PHONY: clean
42 clean:
43 @find . -type f -name '*.FAIL' -delete
44
45 .PHONY: test
46 test:
47 @go test -count=1 ./...
48
49 test-tparse:
50 @go test -race -count=1 ./internal/... -json -cover | go run main.go -trimpath=auto -sort=elapsed
51 @go test -race -count=1 ./tests/... -json -cover -coverpkg=./parse | go run main.go -trimpath=github.com/mfridman/tparse/ -sort=elapsed
52
53 # dogfooding :)
54 test-tparse-full:
55 go test -race -count=1 -v ./... -json | go run main.go -all -smallscreen -notests -sort=elapsed
56
57 coverage:
58 go test ./tests/... -coverpkg=./parse -covermode=count -coverprofile=count.out
59 go tool cover -html=count.out
60
61 search-todo:
62 @echo "Searching for TODOs in Go files..."
63 @rg '// TODO\(mf\):' --glob '*.go' || echo "No TODOs found."
64