Repository navigation
Update documentation paths on major bumps with ignore-next-line support - #37
Merged
Merged
Conversation
Rewrite self-referential documentation URLs, badges, examples, and Go comments alongside major module path updates. Preserve version pins and unrelated references, and support goversion:ignore-next-line for intentional cross-major documentation links. Keep dry-run reporting and automatic staging aligned with the rewritten files.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
References to nested modules can be incorrectly rewritten as packages of the bumped module.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds automatic documentation-reference migration during major module-version bumps.
Changes:
- Rewrites Markdown and Go-comment module references.
- Adds ignore-next-line directives and regression coverage.
- Includes rewritten documentation in dry runs and commits.
| File | Description |
|---|---|
README.md |
Documents migration behavior and directives. |
pkg/goversion.go |
Integrates discovery, rewriting, staging, and reporting. |
pkg/documentation.go |
Implements documentation rewriting and filtering. |
pkg/documentation_test.go |
Tests rewriting and major-bump integration. |
pkg/documentation_directive_test.go |
Tests ignore directives and line endings. |
pkg/doc.go |
Updates package-level API documentation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Share Git-aware file discovery across documentation and import rewriting. Build scan eligibility from tracked and nonignored files so ignored dependency and build directories are not traversed, while tracked files and ignore exceptions remain eligible.
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.

Update self-referential
pkg.go.dev/godoc.orglinks, badges, example imports, and installation commands in Markdown and Go comments whengoversion majorchanges the module path.Preserve anchors, query parameters, pinned versions, other major paths, unrelated URLs, and runtime string literals; let
@latestfollow the new module path.Add
<!-- goversion:ignore-next-line -->for Markdown and standalone// goversion:ignore-next-linecomments for Go documentation. Preserve the next physical line without suppressing actual import orgo.modupdates.Share documentation discovery between dry runs and real bumps, deduplicate affected paths, and include rewritten docs in the version commit automatically.
Share Git-aware discovery across import and documentation scans. Prune directories containing no tracked or nonignored files before descent, including fully ignored
node_modulesand build trees; retain tracked files and ignore-rule exceptions. Always skip nested modules, vendor directories, Git internals, and symlinks.Stage tracked updates separately so tracked docs inside ignored directories remain supported without force-adding build output.
Document the behavior and directive with before/after links and examples. Existing module migration remains limited to the
majordirective; explicit versions andpremajorare unchanged.Add regression tests for version/path boundaries, Markdown formatting, Go comments, CRLF preservation, ignored files, directives, and dry-run/commit parity. Include test-file imports in dry-run reporting.
Verified
go test ./...,go test -race ./...,go vet ./...,go build ./..., andgit diff --check.Add
-skip-docsandVersionOptions.SkipDocsto disable automatic documentation rewriting and its dry-run reporting while retaining module-path updates, self-import rewriting, explicit bump files, and post-bump hooks. Cover the flag through CLI, library, and hook integration tests.