Fix Makefile: use -C flag to set module root
This commit is contained in:
18
Makefile
18
Makefile
@@ -27,12 +27,12 @@ help: ## Show this help message
|
|||||||
|
|
||||||
build: ## Build the binary
|
build: ## Build the binary
|
||||||
@echo "Building $(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)"
|
@echo "Build complete: $(BINARY)"
|
||||||
|
|
||||||
build-all: ## Build all binaries
|
build-all: ## Build all binaries
|
||||||
@echo "Building all binaries..."
|
@echo "Building all binaries..."
|
||||||
@cd $(ROOTDIR) && $(GOBUILD) -o $(BINARY) ./...
|
@$(GOBUILD) -C $(ROOTDIR) -o $(BINARY) ./...
|
||||||
|
|
||||||
clean: ## Clean build artifacts
|
clean: ## Clean build artifacts
|
||||||
@echo "Cleaning..."
|
@echo "Cleaning..."
|
||||||
@@ -42,21 +42,21 @@ clean: ## Clean build artifacts
|
|||||||
|
|
||||||
install: ## Install the binary to $GOPATH/bin
|
install: ## Install the binary to $GOPATH/bin
|
||||||
@echo "Installing $(BINARY)..."
|
@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"
|
@echo "Install complete"
|
||||||
|
|
||||||
test: ## Run tests
|
test: ## Run tests
|
||||||
@echo "Running tests..."
|
@echo "Running tests..."
|
||||||
@cd $(ROOTDIR) && $(GOTEST) -v ./...
|
@$(GOTEST) -C $(ROOTDIR) -v ./...
|
||||||
|
|
||||||
test-coverage: ## Run tests with coverage
|
test-coverage: ## Run tests with coverage
|
||||||
@echo "Running tests with coverage..."
|
@echo "Running tests with coverage..."
|
||||||
@cd $(ROOTDIR) && $(GOTEST) -v -coverprofile=coverage.out ./...
|
@$(GOTEST) -C $(ROOTDIR) -v -coverprofile=coverage.out ./...
|
||||||
@cd $(ROOTDIR) && $(GOCMD) tool cover -html=coverage.out -o coverage.html
|
@$(GOCMD) tool -C $(ROOTDIR) cover -html=coverage.out -o coverage.html
|
||||||
|
|
||||||
fmt: ## Format Go code
|
fmt: ## Format Go code
|
||||||
@echo "Formatting code..."
|
@echo "Formatting code..."
|
||||||
@cd $(ROOTDIR) && $(GOCMD) fmt ./...
|
@$(GOCMD) fmt -C $(ROOTDIR) ./...
|
||||||
|
|
||||||
lint: ## Run golangci-lint (if installed)
|
lint: ## Run golangci-lint (if installed)
|
||||||
@echo "Running linter..."
|
@echo "Running linter..."
|
||||||
@@ -68,8 +68,8 @@ lint: ## Run golangci-lint (if installed)
|
|||||||
|
|
||||||
deps: ## Download dependencies
|
deps: ## Download dependencies
|
||||||
@echo "Downloading dependencies..."
|
@echo "Downloading dependencies..."
|
||||||
@cd $(ROOTDIR) && $(GOMOD) download
|
@$(GOMOD) -C $(ROOTDIR) download
|
||||||
@cd $(ROOTDIR) && $(GOMOD) tidy
|
@$(GOMOD) -C $(ROOTDIR) tidy
|
||||||
|
|
||||||
run: build ## Build and run the binary
|
run: build ## Build and run the binary
|
||||||
@echo "Running $(BINARY)..."
|
@echo "Running $(BINARY)..."
|
||||||
|
|||||||
Reference in New Issue
Block a user