fix(golang): reject // indirect //exhortignore as ignore marker#538
Merged
Conversation
…345) The greedy regex in IgnoredLine matched the last // in a line, causing "// indirect //exhortignore" to be incorrectly treated as ignored. Parse the first // comment instead and only accept standalone ignore markers or the semicolon-separated format (// indirect; exhortignore), matching the JavaScript client behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Reviewer's GuideRefines the Go modules ignore-line detection logic to only treat well-formed comment markers as ignore directives and adds tests to ensure malformed double-slash formats like "// indirect //exhortignore" are not incorrectly recognized. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new
comment.matches(...)checks inIgnoredLinewill compile the regex on every call; consider extracting these into precompiledPatternconstants to avoid repeated compilation and make the ignore-format rules easier to read and maintain.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `comment.matches(...)` checks in `IgnoredLine` will compile the regex on every call; consider extracting these into precompiled `Pattern` constants to avoid repeated compilation and make the ignore-format rules easier to read and maintain.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #538 +/- ##
=======================================
Coverage ? 68.72%
Complexity ? 1000
=======================================
Files ? 65
Lines ? 4253
Branches ? 744
=======================================
Hits ? 2923
Misses ? 990
Partials ? 340
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
…tants Avoids recompiling regexes on every IgnoredLine call. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Strum355
approved these changes
Jun 23, 2026
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.
Summary
IgnoredLinethat incorrectly treated// indirect //exhortignoreas an ignored dependency (TC-4345)//comment and only accept standalone ignore markers (// exhortignore) or the semicolon-separated format (// indirect; exhortignore), matching the JavaScript client behavior// indirect //exhortignoreformatTest plan
test_IgnoredLine_rejects_old_space_separated_indirect_formatpasses with new assertionsgolang-go_mod_with_ignore[stack]that Java and JS clients produce matching results🤖 Generated with Claude Code
Summary by Sourcery
Update Go modules ignore-line detection to only treat standalone or semicolon-separated ignore markers as valid, and align behavior with the JavaScript client.
Bug Fixes:
Tests: