From 5ac68db85406db846a35e72d52ea43d03fa00021 Mon Sep 17 00:00:00 2001 From: Calmcacil Date: Mon, 12 Jan 2026 19:00:35 +0100 Subject: [PATCH] Fix Makefile: use -C flag to set module root --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 766f57c..cfeb4a3 100644 --- a/Makefile +++ b/Makefile @@ -27,12 +27,12 @@ help: ## Show this help message build: ## Build the binary @echo "Building $(BINARY)..." - @cd $(ROOTDIR) && $(GOBUILD) -o $(BINARY) $(CMD_PATH)/main.go + @$(GOBUILD) -C $(ROOTDIR) -o $(BINARY) cmd/$(BINARY)/main.go @echo "Build complete: $(BINARY)" build-all: ## Build all binaries @echo "Building all binaries..." - @cd $(ROOTDIR) && $(GOBUILD) -o $(BINARY) ./... + @$(GOBUILD) -C $(ROOTDIR) -o $(BINARY) ./... clean: ## Clean build artifacts @echo "Cleaning..." @@ -42,21 +42,21 @@ clean: ## Clean build artifacts install: ## Install the binary to $GOPATH/bin @echo "Installing $(BINARY)..." - @cd $(ROOTDIR) && $(GOBUILD) -o $$($(GOCMD) env GOPATH)/bin/$(BINARY) $(CMD_PATH)/main.go + @$(GOBUILD) -C $(ROOTDIR) -o $$($(GOCMD) env GOPATH)/bin/$(BINARY) cmd/$(BINARY)/main.go @echo "Install complete" test: ## Run tests @echo "Running tests..." - @cd $(ROOTDIR) && $(GOTEST) -v ./... + @$(GOTEST) -C $(ROOTDIR) -v ./... test-coverage: ## Run tests with coverage @echo "Running tests with coverage..." - @cd $(ROOTDIR) && $(GOTEST) -v -coverprofile=coverage.out ./... - @cd $(ROOTDIR) && $(GOCMD) tool cover -html=coverage.out -o coverage.html + @$(GOTEST) -C $(ROOTDIR) -v -coverprofile=coverage.out ./... + @$(GOCMD) tool -C $(ROOTDIR) cover -html=coverage.out -o coverage.html fmt: ## Format Go code @echo "Formatting code..." - @cd $(ROOTDIR) && $(GOCMD) fmt ./... + @$(GOCMD) fmt -C $(ROOTDIR) ./... lint: ## Run golangci-lint (if installed) @echo "Running linter..." @@ -68,8 +68,8 @@ lint: ## Run golangci-lint (if installed) deps: ## Download dependencies @echo "Downloading dependencies..." - @cd $(ROOTDIR) && $(GOMOD) download - @cd $(ROOTDIR) && $(GOMOD) tidy + @$(GOMOD) -C $(ROOTDIR) download + @$(GOMOD) -C $(ROOTDIR) tidy run: build ## Build and run the binary @echo "Running $(BINARY)..."