Exclude vendor directories from CI gofmt formatting checks in ci-workflow.yaml
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
Direzione di ricerca
The failing step is the Check formatting job in .github/workflows/ci-workflow.yaml (around line 244), which runs gofmt -l validator and recurses into validator/vendor/. Read the comment in .pre-commit-config.yaml that claims the vendor exclude covers this gate, then check which other Go module jobs run gofmt the same way. Done means go mod vendor in validator/ leaves git diff validator/vendor/ empty and the CI formatting step passes without gofmt -w. The issue says agents may not edit the workflow file, so this needs a maintainer to authorize the change.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happened
During the implementation of PR #555, the code agent added validator/vendor/ to vendor gopkg.in/yaml.v3 v3.0.1 so that the spec-validator pre-commit hook could build offline in sandboxed environments with GOPROXY=off. While .pre-commit-config.yaml was configured to exclude validator/vendor/.* from the local gofmt hook, GitHub Actions CI workflow runs 44815928254 and 44815939634 failed during the V2 specification validator job's Check formatting step (.github/workflows/ci-workflow.yaml:244).
The failure occurred because CI runs files="$(gofmt -l validator)" || exit $? directly against the validator directory, which recursed into validator/vendor/ and detected formatting variances in upstream yaml.v3 source files. To unblock CI in commit 7454bfb, the fix agent ran gofmt -w on validator/vendor/, modifying 9 of the 13 third-party Go files. In his review on commit 7454bfb, maintainer John Strunk pointed out: 'The vendor comment is false, and the exclude does not reach the gate it was added for... CI's .github/workflows/ci-workflow.yaml:244 runs gofmt -l validator, which recurses into vendor/ and ignores the pre-commit exclude. A future go mod vendor restores the upstream bytes and fails that CI job again. Fix: state the real invariant and the procedure in the comment... Do not revert to a pristine vendor tree: that needs a change to the CI gofmt step under .github/workflows/, which you may not make.'
Because agent workflows are strictly forbidden from modifying .github/workflows/ci-workflow.yaml, the agent could not fix the root cause in CI. A human-authorized workflow fix is needed so vendored dependencies remain pristine.
What could go better
Third-party vendored dependencies should remain byte-for-byte identical to their upstream sources. Running gofmt -w against validator/vendor/ violates this invariant and creates maintenance friction: any developer or agent running go mod vendor in the future will restore the upstream formatting, re-triggering CI formatting failures.
CI currently runs gofmt -l <dir> directly via shell commands across module jobs rather than using scripts/check_gofmt.py or excluding vendor/ subdirectories. By updating .github/workflows/ci-workflow.yaml to exclude vendor/ directories from gofmt -l, validator/vendor/ can be restored to pristine upstream bytes without failing the CI formatting gate.
Proposed change
In .github/workflows/ci-workflow.yaml, update the Check formatting step under the validator job (and ensure equivalent protection across other Go module jobs) to exclude vendor/ directories from gofmt inspection.
Specifically, replace:
- name: Check formatting
run: |
files="$(gofmt -l validator)" || exit $?
test -z "$files"
with a command that ignores vendor/, such as:
- name: Check formatting
run: |
files="$(find validator -name '*.go' -not -path '*/vendor/*' -exec gofmt -l {} +)" || exit $?
test -z "$files"
or invoke python3 scripts/check_gofmt.py passing only non-vendor files. Once the CI step excludes vendor/, re-run go mod vendor inside validator/ to restore validator/vendor/gopkg.in/yaml.v3 to pristine upstream formatting, and update the comment in .pre-commit-config.yaml accordingly.
Validation criteria
- In
validator/, executinggo mod vendorfollowed bygit diff validator/vendor/produces pristine upstream files identical togopkg.in/yaml.v3 v3.0.1. - Running the updated
.github/workflows/ci-workflow.yamlon a PR carrying pristine vendored code succeeds on theCheck formattingstep without requiring manualgofmt -w.
Related issues checked
Searched: gofmt vendor repo:redhat-et/ProtoBot is:issue; vendor ci-workflow repo:redhat-et/ProtoBot is:issue; gofmt exclude vendor repo:redhat-et/ProtoBot is:issue; gofmt vendor repo:fullsend-ai/fullsend repo:fullsend-ai/agents repo:redhat-et/ProtoBot is:issue; vendor formatting repo:fullsend-ai/fullsend repo:fullsend-ai/agents repo:redhat-et/ProtoBot is:issue
Considered: #560, #544
#560 proposes standardizing Go module checks via composite action but retains gofmt recursion over module paths without vendor exclusion. #544 resolved local offline pre-commit failures by vendoring validator/vendor/ but did not update ci-workflow.yaml, leading directly to the gofmt CI failure when vendor/ was added.
Generated by retro agent from https://github.com/redhat-et/ProtoBot/pull/555
- Lingua principale
- Go
- Stelle
- 7
- Fork
- 9
- Merge medio
- 22h 37m
- PR unite (30g)
- 118
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di redhat-et/ProtoBot
-
bug component:validator triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
redhat-et/ProtoBot#596 · 5 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
documentation triaged
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
redhat-et/ProtoBot#589 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
documentation risk/low triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
redhat-et/ProtoBot#588 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
feature infra needs-human risk/low triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
redhat-et/ProtoBot#579 · 6 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
blocked documentation infra risk/low triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
redhat-et/ProtoBot#552 · 6 commenti · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di redhat-et/ProtoBot
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
sresarehumantoo/cc-artex#456 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ollama/ollama#20021 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
factory:subtask
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
release
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
github/gh-aw-mcpg#17603 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tinygo-org/tinygo#6727 ·
I maintainer di solito rispondono entro 1 giorno