Skip to content

Commit 80758c0

Browse files
committed
fix(govet): change execution to sequential to reduce memory usage
Updated Go vet execution from parallel to sequential to avoid memory issues during static analysis. This change ensures that packages are vetted one at a time, optimizing memory consumption.
1 parent 185dbbb commit 80758c0

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

.github/workflows/fortress-code-quality.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,37 @@ jobs:
111111
runner-os: ${{ inputs.primary-runner }}
112112

113113
# --------------------------------------------------------------------
114-
# Run go vet with parallel execution
114+
# Run go vet with sequential execution to avoid memory issues
115115
# --------------------------------------------------------------------
116-
- name: 🔍 Go vet (parallel)
116+
- name: 🔍 Go vet (sequential)
117117
run: |
118-
echo "🚀 Running static analysis with go vet (parallel mode)..."
118+
echo "🚀 Running static analysis with go vet (sequential mode)..."
119119
GO_MODULE_DIR="${{ env.GO_MODULE_DIR }}"
120120
121+
# Run go vet on packages sequentially to reduce memory usage
121122
if [ -n "$GO_MODULE_DIR" ]; then
122-
echo "🔧 Running magex vet from directory: $GO_MODULE_DIR"
123-
(cd "$GO_MODULE_DIR" && magex vet)
123+
echo "🔧 Running go vet from directory: $GO_MODULE_DIR"
124+
cd "$GO_MODULE_DIR"
124125
else
125-
echo "🔧 Running magex vet from repository root"
126-
magex vet
126+
echo "🔧 Running go vet from repository root"
127127
fi
128128
129+
# Get all packages and vet them one at a time
130+
PACKAGES=$(go list ./... 2>/dev/null | grep -v /vendor/)
131+
TOTAL=$(echo "$PACKAGES" | wc -l | xargs)
132+
CURRENT=0
133+
134+
echo "📦 Found $TOTAL packages to vet"
135+
136+
for pkg in $PACKAGES; do
137+
CURRENT=$((CURRENT + 1))
138+
echo "[$CURRENT/$TOTAL] Vetting $pkg..."
139+
if ! go vet "$pkg"; then
140+
echo "❌ go vet failed on package: $pkg"
141+
exit 1
142+
fi
143+
done
144+
129145
echo "✅ Static analysis completed successfully"
130146
131147
# --------------------------------------------------------------------
@@ -138,7 +154,7 @@ jobs:
138154
echo "| Analysis Details | Status |" >> $GITHUB_STEP_SUMMARY
139155
echo "|---|---|" >> $GITHUB_STEP_SUMMARY
140156
echo "| **Tool** | go vet (Official Go Static Analyzer) |" >> $GITHUB_STEP_SUMMARY
141-
echo "| **Execution** | Project packages only |" >> $GITHUB_STEP_SUMMARY
157+
echo "| **Execution** | Sequential (memory-optimized) |" >> $GITHUB_STEP_SUMMARY
142158
echo "| **Scope** | ./... (excludes dependencies) |" >> $GITHUB_STEP_SUMMARY
143159
echo "| **Result** | ✅ No issues found |" >> $GITHUB_STEP_SUMMARY
144160
echo "" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)