11MIN_TEST_COVERAGE := 90
22APP_NAME := gofindimpl
33
4- .PHONY : all dep lint lint-fix test test-coverage build build-race
4+ .PHONY : all dep lint lint-ci lint- fix test test-coverage test-coverage-ci build build-race
55
66all : dep lint-fix test-coverage build # # Run all tasks
77
@@ -15,6 +15,11 @@ lint: ## Lint all Golang files
1515 @go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test ./...
1616 @go tool golangci-lint run --timeout=30m0s ./...
1717
18+ lint-ci : # # Lint all Golang files (CI - readonly vendor mode)
19+ @echo " Linting all Go files (CI mode - fuck vendor validation)..."
20+ @go run -mod=readonly golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test ./...
21+ @go tool -mod=readonly golangci-lint run --timeout=30m0s ./...
22+
1823lint-fix : # # Lint all Golang files and fix
1924 @echo " Linting all Go files..."
2025 @go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...
@@ -41,6 +46,23 @@ test-coverage: ## Run tests with coverage check. Fails if coverage is below the
4146 exit 1; \
4247 fi
4348
49+ test-coverage-ci : # # Run tests with coverage check (CI - readonly vendor mode)
50+ @echo " Running tests with coverage check (CI mode - bypassing vendor bullshit)..."
51+ @trap ' rm -f coverage.txt' EXIT; \
52+ go test -mod=readonly -race -coverprofile=coverage.txt $$(go list ./... ) ; \
53+ if [ $$ ? -ne 0 ]; then \
54+ echo " Test failed. Exiting." ; \
55+ exit 1; \
56+ fi ; \
57+ result=$$(go tool cover -func=coverage.txt | grep -oP 'total:\s+\(statements\ ) \s +\K\d +' || echo "0"); \
58+ if [ $$ result -eq 0 ]; then \
59+ echo " No test coverage information available." ; \
60+ exit 0; \
61+ elif [ $$ result -lt $( MIN_TEST_COVERAGE) ]; then \
62+ echo " FAIL: Coverage $$ result% is less than the minimum $( MIN_TEST_COVERAGE) %" ; \
63+ exit 1; \
64+ fi
65+
4466build : # # Build the app binary using Docker (optimized, no debug info)
4567 @echo " Building $( APP_NAME) binary (optimized)..."
4668 @mkdir -p ./build
0 commit comments