ci: add gofmt enforcement and mint embed sync checks#1714
Conversation
ReviewFindingsMedium
Low
Info
Previous runReviewFindingsMedium
Low
Previous run (2)ReviewFindingsMedium
Info
|
Site previewPreview: https://bc23bcd2-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.
| 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.
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.
Fix formatting violations across 18 files, including the switch role{}
regression on types.go flagged in fullsend-ai#960. Sync mint embed copy.
Closes 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>
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>
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>
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
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
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