Apply PR #110's Read index doc comment fix to the v2 legacy index module - #207
Merged
sinmetal merged 1 commit intoAug 3, 2026
Conversation
…e v2 legacy index module refs * cloudspannerecosystem#205
sinmetal
marked this pull request as ready for review
August 3, 2026 06:47
vvakame
approved these changes
Aug 3, 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
v2/module/builtin/templates/legacy_index.go.tplhardcodes the doc comment on every generatedRead{{ .LegacyFuncName }}as// Generated from unique index '...'., even when the underlying index is not unique. Users of the legacy index module (--use-legacy-index-module) therefore still see misleading doc comments on non-unique-indexReadXxxfunctions.This is the same issue that #110 (merged 2022-12-07) fixed for
module/builtin/templates/index.go.tpl, and that #205 backported to the v1 templates.legacy_index.go.tplwas missed by both, so after #205 the v1 output and the v2 legacy output disagree on the same comment:Change
Mirror #110 and #205 exactly — drop the word
uniquefrom theRead{{ .LegacyFuncName }}doc comment so it reads// Generated from index '...'.regardless of uniqueness:+// Generated from index '{{ .IndexName }}'. func Read{{ .LegacyFuncName }}(ctx context.Cont.KeySet) ([]*{{ .Type.Name }}, error) {v2/test/testmodels/legacy_default/**/*.yo.gois regenerated viamake -C v2 testdata-from-ddlto reflect the template change.The
Find{{ .LegacyFuncName }}comment is left nside an{{ if .IsUnique }}branch, souniqueindexis accurate there.Scope
v2/module/builtin/templates/legaegeneratedv2/test/testmodels/legacy_default/`(5 files, 17 lines).v2/test/testmodels/default/and `dump_types/legacy index module was already fixed by Fix typo in index.go.tpl #110.go:embed(v2/module/builtin/module.go), so there is no v1-styletplbinregeneration step.