Skip to content

ci: run the gofmt check on every Go folder - #60

Merged
Aswin-V merged 1 commit into
masterfrom
ci/gofmt-all-dirs
Nov 10, 2026
Merged

Aswin-V merged 1 commit into
masterfrom
ci/gofmt-all-dirs

Conversation

@Kartikey1306

@Kartikey1306 Kartikey1306 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Gofmt check step in ci.yml now runs gofmt -l . instead of gofmt -l cmd core transport. The old list skipped six of the module's nine Go folders (config, examples, protocol, security, services, tests), so an unformatted file there passed CI. gofmt -l . is the command CONTRIBUTING.md and AGENTS.md already give, and the tree is clean today, so the step stays green.

Type of Change

  • feat — New feature
  • fix — Bug fix
  • docs — Documentation only
  • style — Formatting, no code change
  • refactor — Code restructuring without behavior change
  • test — Add or fix tests
  • build — Build system or dependency changes
  • ci — CI/CD pipeline changes
  • perf — Performance improvement

Changes

  • .github/workflows/ci.yml: the step's command is gofmt -l ., with a comment saying why it is not a folder list. The error message and the exit 1 are unchanged.

No Go code changes. The step still runs on all three OSes; .gitattributes (*.go text eol=lf, from #42) keeps the Windows checkout LF, so gofmt -l . sees the same bytes there.

Testing

  • Unit tests pass (ctest --test-dir build --output-on-failure)
  • Integration tests pass
  • Manual testing performed
  • New tests added for new functionality

The check below parses ci.yml, takes the Gofmt check step's run script exactly as written (it asserts the step exists once, in job test, with shell: bash), and runs it on a copy of the tree with the shell flags GitHub uses for shell: bash (bash --noprofile --norc -eo pipefail), four times: clean, with an unformatted file planted in core/ (a folder the old list covered), with one planted in protocol/ (a folder it skipped), and with a file in security/ that gofmt cannot parse. Run on macOS 26 arm64 with Go 1.26.10, the version go.mod pins, at 5f089d6.

Check Command Result
Step from master's ci.yml (70748b2) check.sh <repo> ci-master.yml FAIL as expected: protocol/ exit 0 with an unformatted file present, and the security/ syntax error exit 0 (never parsed). Clean tree exit 0, core/ exit 1
Step from this branch's ci.yml check.sh <repo> .github/workflows/ci.yml PASS: clean exit 0, core/ exit 1, protocol/ exit 1 (::error::files need gofmt: protocol/zz_planted.go), security/ syntax error exit 2 (expected ')', found '{')
Build (as in CI) go build ./... PASS
Vet (as in CI) go vet ./... PASS, no findings
Gofmt (new step) gofmt -l . PASS, 0 files
Test (as in CI) go test -race -count=1 ./... PASS: 18 packages ok, 7 with no test files
Cross-compile (as in CI) make build-all PASS: 14 binaries
YAML yamllint -d relaxed .github/workflows/ci.yml PASS, no output
Whitespace git diff --check origin/master HEAD PASS
windows-2022 / macos-latest / ubuntu-22.04 legs GitHub Actions NOT RUN locally (run on this PR)

Pre-Submission Checklist

  • Code compiles without warnings (-Wall -Wextra -Werror for C): no C or Go code touched
  • All existing tests pass
  • New tests added for new functionality: CI-only change; the check script is in the logs below
  • Documentation updated if API changed: no API change
  • Commit messages follow (): convention
  • Branch is rebased on latest master

Closing issue

Fixes #59

Screenshots / Logs

The step from master's ci.yml and from this branch, on the same three trees:

gofmt step before and after

Additional Notes

gofmt -l . also walks any testdata/ folder. There is none today; if deliberately unformatted fixtures are added later, the step will need to skip them (for example gofmt -l $(git ls-files '*.go' | grep -v /testdata/)).

Open PR #56 stays green under the new step: gofmt -l . on its head (5245397) prints nothing.

Other CI gaps (the C SDK and its ctests are not built in CI, fuzz targets are not run) are separate and not touched here.

Summary by Sourcery

CI:

  • Expand the CI gofmt check to cover every Go file in the repository instead of a manually maintained subset of folders.

The Gofmt check step listed three folders (cmd core transport), so an
unformatted file in config, examples, protocol, security, services or
tests passed CI. Run gofmt -l . instead, which is the command
CONTRIBUTING.md and AGENTS.md already give. The whole tree is clean
today, so the step stays green.
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Run the CI gofmt check across the repository instead of a hand-maintained list of Go folders.

  • .github/workflows/ci.yml L39-43

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@qodo-code-review

Copy link
Copy Markdown

ⓘ Your Qodo trial ends soon. Ask your workspace admin to set up billing to keep reviews running after the trial. Manage billing

@kody-ai

kody-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown

You've used all your free Kodus-paid PR reviews 🎁

Your trial is still active — this just means the PR reviews we cover during the trial are used up.

Connect your own AI key to keep Kody reviewing — unlimited reviews, on any plan (Free included).

Want more trial reviews to finish evaluating before adding a key? Talk to our founders. 😎

@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6d1fc0f5-7c2b-44f6-8963-2a91d2a66491
Commits

Reviewing files that changed from the base of the PR and between 70748b2 and 5f089d6.

Files selected for processing: 1

  • .github/workflows/ci.yml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Check formatting across all Go folders in CI

🐞 Bug fix ⚙️ Configuration changes 🕐 Less than 5 minutes

Grey Divider

AI Description

• Run gofmt across the repository so files outside the previously listed folders cannot bypass CI.
• Keep the existing formatting error and failure behavior.
High-Level Assessment

Checking from the repository root is the simplest way to prevent new Go folders from escaping the formatting check. Maintaining a folder list would recreate the coverage gap.

Files changed (1) +4 / -1

Bug fix (1) +4 / -1
ci.ymlExpand the CI gofmt check to the whole repository +4/-1

Expand the CI gofmt check to the whole repository

• Replaces the three-folder argument list with 'gofmt -l .' and documents why the list was removed. The existing error message and nonzero exit for unformatted files remain unchanged.

.github/workflows/ci.yml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Qodo Logo

@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Linked issues

Checked at commit 5f089d6

#59 CI gofmt check only covers cmd, core and transport, so unformatted code elsewhere passes · 1 of 1 met

# Requirement Status Notes
1 The CI step fails on an unformatted Go file in any folder of the module. ✅ Met The Gofmt check now runs gofmt -l . instead of checking only cmd, core and transport.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/ci.yml" line_range="43" />
<code_context>
+        # examples, protocol, security, services and tests.
         run: |
-          out=$(gofmt -l cmd core transport)
+          out=$(gofmt -l .)
           if [ -n "$out" ]; then
             echo "::error::files need gofmt: $out"
</code_context>
<issue_to_address>
**Skipped folders stay unchecked**

When a later change narrows the command back to a folder list and the tree has no unformatted files, a later change that restores the old folder list leaves the clean tree green, so an unformatted file in a previously skipped folder passes CI without a regression test catching it.

Add a maintained regression test that verifies the check fails for an unformatted Go file in a previously skipped folder.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: .github/workflows/ci.yml:43


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/ci.yml
# examples, protocol, security, services and tests.
run: |
out=$(gofmt -l cmd core transport)
out=$(gofmt -l .)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Skipped folders stay unchecked

When a later change narrows the command back to a folder list and the tree has no unformatted files, a later change that restores the old folder list leaves the clean tree green, so an unformatted file in a previously skipped folder passes CI without a regression test catching it.

Add a maintained regression test that verifies the check fails for an unformatted Go file in a previously skipped folder.

Prompt for AI agents
In `.github/workflows/ci.yml` at line 43:

**Skipped folders stay unchecked**

When a later change narrows the command back to a folder list and the tree has no unformatted files, a later change that restores the old folder list leaves the clean tree green, so an unformatted file in a previously skipped folder passes CI without a regression test catching it.

Add a maintained regression test that verifies the check fails for an unformatted Go file in a previously skipped folder.

From TESTING.md L12:

- **Regression** — every fixed defect gets a test that would have caught it.

@Aswin-V
Aswin-V merged commit 2d76386 into master Nov 10, 2026
15 checks passed
@Aswin-V
Aswin-V deleted the ci/gofmt-all-dirs branch November 10, 2026 19:00
@Aswin-V

Aswin-V commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Premise: pass — master ci.yml:40 ran gofmt -l cmd core transport, skipping six of nine Go folders (config, examples, protocol, security, services, tests); CONTRIBUTING.md:63 + AGENTS.md:115 already prescribe gofmt -l .. Widened step passed on all 3 OS legs at the PR head, so no unformatted code in the newly covered folders.
Contract: n/a — CI-only.
CI: green @5f089d6c (15 checks; Build & Test all 3 OSes success incl. Gofmt check step; policy success).
Integration: Integration-unverified: infra (nightly Unified Build quota failure, 6th night).
Reviewer: loop run 2026-11-10 (stewardship batch 2, premise verified vs live master; gofmt risk disproven at job-step level)
Second look: n/a (not multi-look class)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI gofmt check only covers cmd, core and transport, so unformatted code elsewhere passes

2 participants