From b34a8f461beec3aa6bd124fbecf0fa57a53e4414 Mon Sep 17 00:00:00 2001 From: Fimeg Date: Wed, 29 Oct 2025 12:00:11 -0400 Subject: [PATCH] Add go mod tidy to build process for fresh clones - Update Makefile to include go mod tidy in all build targets - Add build-all target specifically for fresh clone deployment - Update README to include go mod tidy in manual build instructions - Resolves 'updates to go.mod needed' error after module path changes --- Makefile | 10 ++++++++-- README.md | 10 ++++++++-- TEST-CLONE.md | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 27db635..63700fb 100644 --- a/Makefile +++ b/Makefile @@ -21,14 +21,20 @@ agent: ## Build and run the agent cd aggregator-agent && go mod tidy && go run cmd/agent/main.go build-server: ## Build server binary - cd aggregator-server && go build -o bin/aggregator-server cmd/server/main.go + cd aggregator-server && go mod tidy && go build -o bin/aggregator-server cmd/server/main.go build-agent: ## Build agent binary - cd aggregator-agent && go build -o bin/aggregator-agent cmd/agent/main.go + cd aggregator-agent && go mod tidy && go build -o bin/aggregator-agent cmd/agent/main.go clean: ## Clean build artifacts rm -rf aggregator-server/bin aggregator-agent/bin +build-all: ## Build with go mod tidy for fresh clones + @echo "Building all components with dependency cleanup..." + cd aggregator-server && go mod tidy && go build -o redflag-server cmd/server/main.go + cd aggregator-agent && go mod tidy && go build -o redflag-agent cmd/agent/main.go + @echo "Build complete!" + test: ## Run tests cd aggregator-server && go test ./... cd aggregator-agent && go test ./... diff --git a/README.md b/README.md index 509d57a..970f3b8 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,14 @@ A self-hosted, cross-platform update management platform built for homelabs and ```bash # Clone and build git clone https://github.com/Fimeg/RedFlag.git -cd RedFlag/aggregator-server -go build -o redflag-server cmd/server/main.go +cd RedFlag + +# Option 1: Use Makefile (recommended) +make build-all + +# Option 2: Manual build +cd aggregator-server && go mod tidy && go build -o redflag-server cmd/server/main.go +cd ../aggregator-agent && go mod tidy && go build -o redflag-agent cmd/agent/main.go # Interactive setup wizard sudo ./redflag-server --setup diff --git a/TEST-CLONE.md b/TEST-CLONE.md index 235af53..dc52dfe 100644 --- a/TEST-CLONE.md +++ b/TEST-CLONE.md @@ -12,7 +12,7 @@ git clone https://github.com/Fimeg/RedFlag.git cd RedFlag # Build components (requires Go) -make build +make build-all # Start database docker-compose up -d postgres