Skip to content

Commit 5e1e9bb

Browse files
authored
ci(lint): ignore indirect comment changes in go mod check (loft-sh#3482)
The direct/indirect classification is cosmetic and doesn't affect builds. Different local environments can produce different results for the same go mod tidy command, causing false positives. Only fail on actual dependency version changes, not on whether a dependency is marked as direct or indirect.
1 parent a102537 commit 5e1e9bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/lint.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ jobs:
6868
run: |
6969
go mod tidy
7070
go mod vendor
71-
if [ -n "$(git status --porcelain go.mod go.sum vendor/)" ]; then
71+
72+
# Check for changes, ignoring direct/indirect comment differences
73+
GOMOD_CHANGES=$(git diff go.mod | grep -E '^[-+]\s' | grep -v '^[-+][-+][-+]' | grep -v '// indirect' || true)
74+
GOSUM_CHANGES=$(git diff go.sum)
75+
VENDOR_CHANGES=$(git status --porcelain vendor/)
76+
77+
if [ -n "$GOMOD_CHANGES" ] || [ -n "$GOSUM_CHANGES" ] || [ -n "$VENDOR_CHANGES" ]; then
7278
echo "❌ ERROR: go.mod, go.sum, or vendor/ directory is out of sync."
7379
echo "Please run 'go mod tidy && go mod vendor' and commit the changes."
7480
echo ""

0 commit comments

Comments
 (0)