Repository navigation
feat(guard): guard Go - #786
Merged
Merged
Conversation
Closes #779 Measured on real Go repositories: cobra speaks on 0 of 36 files, gin on 2 of 99 — and gin's two are real, `Binding` being defined in both `binding.go` and `binding_nomsgpack.go`. Two decisions worth naming. **Methods on receivers are not indexed.** #779 argued for including them, since `func (s *Store) Validate()` is package-level API in Go. The noise measurement that came between then and now argued louder: `String`, `Error`, `Read` and `Close` sit on every type in a package, and methods are excluded in Python and TypeScript for exactly that reason. Evidence beat the plan. **Trailing-segment matching is reserved for Go.** Go imports carry the whole module path (`github.com/org/repo/internal/db`) while the repository knows itself as `internal/db`, so the resolver drops leading segments until something matches — no `go.mod` parsing needed. Applying the same rule to TypeScript would resolve `lodash/fp` onto a directory named `fp`, and date-fns has one; a test pins that boundary. The `type (...)` block form is deliberately unsupported. Matching names at one indent level would also match struct fields, and a struct field read as a type declaration is the invented symbol these patterns exist to prevent. One bug in the measurement tool, found by the same instinct that has paid off twice today: gin reported zero cross-directory imports, which was too clean. `measure_boundary_reach` called `import_to_dir` without a suffix, so every Go module path fell through the TypeScript branch and resolved to nothing. With the suffix passed, gin goes from 0 to 21 files across 14 edges. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Jul 29, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #779. I opened it as a good-first-issue; a contributor magnet only works once contributors exist, and shipping it widens the audience now.
Measured on real Go repositories
gin's two are real —
Bindingis defined in bothbinding.goandbinding_nomsgpack.go.Two decisions worth naming
Methods on receivers are not indexed. #779 argued for including them, since
func (s *Store) Validate()is package-level API in Go. The noise measurement that came between then and now argued louder:String,Error,ReadandClosesit on every type in a package, and methods are excluded in Python and TypeScript for exactly that reason. Evidence beat the plan, and the test says so.Trailing-segment matching is reserved for Go. Go imports carry the whole module path (
github.com/org/repo/internal/db) while the repository knows itself asinternal/db, so the resolver drops leading segments until something matches — nogo.modparsing. Applying that rule to TypeScript would resolvelodash/fponto a directory namedfp, and date-fns has one.test_trailing_segment_matching_is_reserved_for_gopins the boundary.The
type (...)block form is deliberately unsupported: matching names at one indent level would also match struct fields, and a struct field read as a type declaration is precisely the invented symbol these patterns exist to prevent.A bug in the measurement tool
gin reported zero cross-directory imports. That was too clean, and the same instinct has now paid off twice (#783).
measure_boundary_reachcalledimport_to_dirwithout a suffix, so every Go module path fell through the TypeScript branch and resolved to nothing — a tidy zero for a signal that was working fine. With the suffix passed:cobra stays at 0, correctly — it is essentially one package.
Verification
134 guard tests (11 new), all nine gates, both Go repositories within the noise budget,
ruffandmypyclean, markdownlint clean.🤖 Generated with Claude Code