diff --git a/.devcontainer.json b/.devcontainer.json index 06ced1e..4ed2e94 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -30,7 +30,7 @@ ], "name": "go-subtree dev container", "postCreateCommand": "magex lint && magex vet && magex test", - "postStartCommand": "go install github.com/magefile/mage/cmd/magex@latest", + "postStartCommand": "go install github.com/mrz1836/mage-x/cmd/magex@latest", "remoteUser": "vscode", "runArgs": [ "--cap-drop=ALL", diff --git a/.github/workflows/fortress-code-quality.yml b/.github/workflows/fortress-code-quality.yml index 1267f0e..cd38461 100644 --- a/.github/workflows/fortress-code-quality.yml +++ b/.github/workflows/fortress-code-quality.yml @@ -111,21 +111,37 @@ jobs: runner-os: ${{ inputs.primary-runner }} # -------------------------------------------------------------------- - # Run go vet with parallel execution + # Run go vet with sequential execution to avoid memory issues # -------------------------------------------------------------------- - - name: 🔍 Go vet (parallel) + - name: 🔍 Go vet (sequential) run: | - echo "🚀 Running static analysis with go vet (parallel mode)..." + echo "🚀 Running static analysis with go vet (sequential mode)..." GO_MODULE_DIR="${{ env.GO_MODULE_DIR }}" + # Run go vet on packages sequentially to reduce memory usage if [ -n "$GO_MODULE_DIR" ]; then - echo "🔧 Running magex vet from directory: $GO_MODULE_DIR" - (cd "$GO_MODULE_DIR" && magex vet) + echo "🔧 Running go vet from directory: $GO_MODULE_DIR" + cd "$GO_MODULE_DIR" else - echo "🔧 Running magex vet from repository root" - magex vet + echo "🔧 Running go vet from repository root" fi + # Get all packages and vet them one at a time + PACKAGES=$(go list ./... 2>/dev/null | grep -v /vendor/) + TOTAL=$(echo "$PACKAGES" | wc -l | xargs) + CURRENT=0 + + echo "📦 Found $TOTAL packages to vet" + + for pkg in $PACKAGES; do + CURRENT=$((CURRENT + 1)) + echo "[$CURRENT/$TOTAL] Vetting $pkg..." + if ! go vet "$pkg"; then + echo "❌ go vet failed on package: $pkg" + exit 1 + fi + done + echo "✅ Static analysis completed successfully" # -------------------------------------------------------------------- @@ -138,7 +154,7 @@ jobs: echo "| Analysis Details | Status |" >> $GITHUB_STEP_SUMMARY echo "|---|---|" >> $GITHUB_STEP_SUMMARY echo "| **Tool** | go vet (Official Go Static Analyzer) |" >> $GITHUB_STEP_SUMMARY - echo "| **Execution** | Project packages only |" >> $GITHUB_STEP_SUMMARY + echo "| **Execution** | Sequential (memory-optimized) |" >> $GITHUB_STEP_SUMMARY echo "| **Scope** | ./... (excludes dependencies) |" >> $GITHUB_STEP_SUMMARY echo "| **Result** | ✅ No issues found |" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY