ci: add gofmt enforcement and mint embed sync checks#1714
Conversation
ReviewFindingsMedium
Low
Info
Previous runReviewFindingsMedium
Low
Info
Previous run (2)ReviewFindingsMedium
Low
Info
Previous run (3)ReviewFindingsMedium
Low
Info
Previous run (4)ReviewFindingsMedium
Low
Previous run (5)ReviewFindingsMedium
Low
Previous run (6)ReviewFindingsHigh
Medium
Low
Info
Previous run (7)ReviewFindingsMedium
Low
Info
Previous run (8)ReviewFindingsMedium
Low
Info
Previous run (9)ReviewFindingsMedium
Low
Info
Previous run (10)ReviewFindingsMedium
Low
Previous run (11)ReviewFindingsMedium
Info
|
Site previewPreview: https://728c13bb-site.fullsend-ai.workers.dev Commit: |
|
|
||
| rc=0 | ||
| for f in main.go go.mod go.sum; do | ||
| if ! diff -q "$SRC/$f" "$DST/$f.embed" >/dev/null 2>&1; then |
There was a problem hiding this comment.
can use cmp here which is a little faster.
There was a problem hiding this comment.
Hello! Thank you, doing that.
| DST="$REPO_ROOT/internal/dispatch/gcf/mintsrc" | ||
|
|
||
| rc=0 | ||
| for f in main.go go.mod go.sum; do |
There was a problem hiding this comment.
I thing its dangarous to assume here that no additional files would be added to the mint codebase, we already have PRs in flight that add files
There was a problem hiding this comment.
Hello Barak. Does it mean we should require anything in internal/mint/ that is not "*_test.go" needs to be mirrored to internal/dispatch/gcf/mintsrc/?
There was a problem hiding this comment.
Hello Barak. Does it mean we should require anything in
internal/mint/that is not "*_test.go" needs to be mirrored tointernal/dispatch/gcf/mintsrc/?
probably, yes.
There was a problem hiding this comment.
Thank you. Did that. Please take a look again.
rh-hemartin
left a comment
There was a problem hiding this comment.
I agree with @ifireball comments, but I'm approving as my concerns were covered and he still have @ifireball request for changes.
fa7a184 to
4ce766e
Compare
|
Rebased due to conflicts. |
4ade97e to
a4e44e2
Compare
|
Rebased due to conflicts and added workaround for eecac65. |
|
🤖 Finished Review · ✅ Success · Started 5:52 AM UTC · Completed 6:00 AM UTC |
Enforce gofmt formatting via pre-commit so violations fail before commit. Placed before go-vet in the local hooks section. Ref fullsend-ai#960 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Generated-by: Claude rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED Signed-off-by: Jan Hutar <jhutar@redhat.com>
Let pre-commit pass staged Go files to gofmt instead of scanning the entire tree. Uses gofmt -w to auto-fix formatting in place. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Generated-by: Claude rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED Signed-off-by: Jan Hutar <jhutar@redhat.com>
Add lint-mint-embed-sync hook that verifies main.go, go.mod, and go.sum in internal/mint/ match their .embed copies in internal/dispatch/gcf/mintsrc/. Runs only when either directory is touched. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Generated-by: Claude rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED Signed-off-by: Jan Hutar <jhutar@redhat.com>
cmp -s is faster for byte-level equality checks where we don't need the actual diff output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Generated-by: Claude rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED Signed-off-by: Jan Hutar <jhutar@redhat.com>
Instead of hardcoding the three files to check, glob all non-test files in internal/mint/ so newly added files are automatically covered. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Generated-by: Claude rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED Signed-off-by: Jan Hutar <jhutar@redhat.com>
Since commit eecac65 there is intentional difference between internal/mint/go.mod and internal/dispatch/gcf/mintsrc/go.mod.embed with replace directive. rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED Signed-off-by: Jan Hutar <jhutar@redhat.com>
rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED Signed-off-by: Jan Hutar <jhutar@redhat.com>
rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED Signed-off-by: Jan Hutar <jhutar@redhat.com>
|
Rebased due to conflict |
|
🤖 Finished Review · ✅ Success · Started 12:04 PM UTC · Completed 12:13 PM UTC |
|
@jhutar merge it and let's be done with this, it is a pain for you to be rebasing every time 🤣 We can address any concern Barak has after the merge. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Hello Hector! Thank you. I do not have permissions to merge. Could you please do it? |
Not relevant.
|
🤖 Finished Retro · ✅ Success · Started 8:05 AM UTC · Completed 8:11 AM UTC |
Retro: PR #1714 —
|
|
Thank you all! |
Summary
gofmtacross all Go source files, fixing 18 formatting violations (including theswitch role{regression from feat(appsetup): add retro agent app configuration #828)gofmtpre-commit hook that fails on unformatted Go fileslint-mint-embed-syncpre-commit hook that detects drift betweeninternal/mint/source files and their.embedcopies ininternal/dispatch/gcf/mintsrc/Closes #960
Test plan
gofmt -l .returns empty after formattingpre-commit run go-fmt --all-filespasses cleanpre-commit run go-fmtfails when a gofmt violation is introducedpre-commit run lint-mint-embed-sync --all-filespasses cleanpre-commit run lint-mint-embed-syncfails when embed copy diverges from sourcego vet ./...passes🤖 Generated with Claude Code