diff options
Diffstat (limited to 'backend/Makefile')
-rw-r--r-- | backend/Makefile | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/backend/Makefile b/backend/Makefile new file mode 100644 index 0000000..0506ee3 --- /dev/null +++ b/backend/Makefile @@ -0,0 +1,47 @@ +# Makefile for the finance backend application + +# Variables +BINARY_NAME=finance-backend +GO=go +GOTEST=$(GO) test +GOVET=$(GO) vet +GOBUILD=$(GO) build + +.PHONY: all build clean test vet run lint + +# Default target +all: test build + +# Build the application +build: + $(GOBUILD) -o $(BINARY_NAME) ./cmd/api/main.go + +# Clean build files +clean: + rm -f $(BINARY_NAME) + +# Run the application +run: build + ./$(BINARY_NAME) + +# Run all tests with verbose output +test: + $(GOTEST) -v ./... + +# Test only the handlers +test-handlers: + $(GOTEST) -v ./handlers/... + +# Run code vetting +vet: + $(GOVET) ./... + +# Run linting (requires golint) +lint: + @command -v golint >/dev/null 2>&1 || { echo >&2 "golint not installed. Installing..."; $(GO) install golang.org/x/lint/golint@latest; } + golint ./... + +# Run tests with coverage report +test-coverage: + $(GOTEST) -coverprofile=coverage.out ./... + $(GO) tool cover -html=coverage.out
\ No newline at end of file |