Introduces a new `lint` Makefile target that checks for golangci-lint installation, runs the linter to match CI pipeline, and updates the help message accordingly.
40 lines
1.2 KiB
Makefile
40 lines
1.2 KiB
Makefile
.PHONY: test test-cover test-agent lint build install clean
|
|
|
|
test:
|
|
go test ./... -v
|
|
|
|
test-cover:
|
|
@mkdir -p build
|
|
go test ./... -coverprofile=build/coverage.out
|
|
go tool cover -html=build/coverage.out -o build/coverage.html
|
|
@echo "✅ Coverage report: open build/coverage.html in your browser"
|
|
|
|
test-agent:
|
|
go test -run TestAgent ./... -v
|
|
|
|
lint:
|
|
@which golangci-lint > /dev/null || (echo "❌ golangci-lint not found. Install with:" && echo " go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest" && exit 1)
|
|
golangci-lint run
|
|
|
|
build:
|
|
@mkdir -p build
|
|
go build -ldflags "-s -w" -trimpath -o build/grokkit .
|
|
|
|
install: build
|
|
mkdir -p ~/.local/bin
|
|
cp build/grokkit ~/.local/bin/grokkit
|
|
chmod +x ~/.local/bin/grokkit
|
|
@echo "✅ grokkit installed to ~/.local/bin"
|
|
|
|
clean:
|
|
rm -rf build/
|
|
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " test Run all tests"
|
|
@echo " test-cover Run tests + generate HTML coverage report"
|
|
@echo " test-agent Run only agent tests"
|
|
@echo " lint Run golangci-lint (matches CI pipeline)"
|
|
@echo " build Build optimized binary"
|
|
@echo " install Build and install to ~/.local/bin"
|
|
@echo " clean Remove build artifacts"
|