Skip to content

ci: catch Go code outside tool modules and close gaps in the Windows job, hook and docs - #8

Merged
sthanikan2000 merged 1 commit into
mainfrom
ci/6-module-guard-windows-go-hook-deletes
Nov 27, 2026
Merged

sthanikan2000 merged 1 commit into
mainfrom
ci/6-module-guard-windows-go-hook-deletes

Conversation

@sthanikan2000

Copy link
Copy Markdown
Member

Summary

Closes gaps in the repo tooling that the review of #2 found:

  • CI passed Go code that sat outside a tool module.
  • The Windows job used the first module's Go version.
  • The pre-commit hook skipped the Go checks for deletion-only commits.
  • .gitleaks.toml kept an allowlist this repo doesn't need.
  • Two doc claims were wrong.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Other (please describe): CI and the git hooks

Changes Made

  • Find modules (ci.yml) fails when:

    • a go.mod isn't at <tool>/go.mod, either at the root or nested inside a tool
    • a .go file is outside every tool module

    The module and Windows jobs would skip that code and CI would still pass. It lists files with git ls-files, so only tracked files count.

  • Make on Windows uses the latest stable Go. It took go-version-file from the first module, and setup-go sets GOTOOLCHAIN=local, so a tool needing a newer Go failed there.

  • pre-commit:

    • It picks the modules to check from deleted .go, go.mod and go.sum files too, so deleting a file another one uses fails the build or lint step.
    • A deleted tool, with no go.mod left, is skipped.
    • It refuses a nested go.mod or go.sum, as CI does.
  • .gitleaks.toml removed. Its only change to gitleaks' default rules was an allowlist for storage keys in core's *_test.go files. That allowlist weakened generic-api-key in every test file here.

  • Docs and Makefile help:

    • Only fmt, lint, license, license-check, tidy, build, test and vuln take /<tool>.
    • A recipe line may be cd <dir> && <command>.
    • Modules don't nest, and every .go file is in a tool module.

Testing

  • I have tested this change locally
  • I have added tests that prove my fix is effective or that my feature works
  • I have tested edge cases
  • All existing tests pass

The repo has no test harness for its CI scripts and hooks, so I ran them by hand:

  • The Find modules script, taken from ci.yml, in scratch repos:

    Layout Result
    no Go code passes, []
    migrator/ passes, ["migrator"]
    migrator/ and seeder/ passes, ["migrator","seeder"]
    a root stray.go fails
    scripts/gen.go fails
    migrator/x/go.mod fails
    a root go.mod fails
  • pre-commit:

    • Staging only the deletion of migrator/parser.go now runs the Go checks, and they fail with undefined: Migration.
    • A staged migrator/x/go.mod is refused.
    • Deleting all of migrator/ skips the Go checks.
    • shellcheck passes.
  • make check passes, and gitleaks with its default rules finds nothing. make shows the new help text.

  • CI on this PR runs the new Find modules step, and the Windows job with stable Go.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have checked that there are no merge conflicts

Related Issues

Closes #6. Related to #2.

Screenshots/Demo

N/A

Additional Notes

None.

…job, hook and docs

Find modules fails when a go.mod isn't at <tool>/go.mod or a .go file is
outside every tool module, since the module jobs would skip that code.
The pre-commit hook refuses a nested go.mod too, and picks the modules
to check from deleted files as well, so a commit that only deletes Go
files still gets built and linted.

The Windows job runs with the latest stable Go, not the first module's,
so a tool that needs a newer Go builds there. .gitleaks.toml goes: its
allowlist was for storage keys in core's tests. The docs say which make
targets take /<tool>, and that a recipe line can be cd <dir> && <cmd>.
@sthanikan2000 sthanikan2000 added the enhancement New feature or request label Nov 27, 2026
@sthanikan2000 sthanikan2000 self-assigned this Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

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: d9abd0b3-ebc4-4e8d-9da1-2fb2f769dcf2
  • 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

@sthanikan2000
sthanikan2000 merged commit e7cc843 into main Nov 27, 2026
9 checks passed
@sthanikan2000
sthanikan2000 deleted the ci/6-module-guard-windows-go-hook-deletes branch November 27, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: catch Go code outside tool modules and close gaps in the Windows job, hook and docs

1 participant