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
This commit is contained in:
Fimeg
2025-10-29 12:00:11 -04:00
parent e40cb14945
commit b34a8f461b
3 changed files with 17 additions and 5 deletions

View File

@@ -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 ./...

View File

@@ -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

View File

@@ -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