[tools] internal/packagepath, inline: add TrimVersionSuffix to handle major version package paths

1 view
Skip to first unread message

Hongxiang Jiang (Gerrit)

unread,
11:31 AM (11 hours ago) 11:31 AM
to goph...@pubsubhelper.golang.org, Alan Donovan, golang...@luci-project-accounts.iam.gserviceaccount.com, Jonathan Amsterdam, golang-co...@googlegroups.com
Attention needed from Alan Donovan and Jonathan Amsterdam

Hongxiang Jiang added 1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Hongxiang Jiang . resolved

I would like Alan to take a look before merge, so I put his CL on hold.

I read rsc@'s [proposal](https://github.com/golang/go/issues/61716) and [blog post](https://go.dev/blog/randv2) especially the [principles](https://go.dev/blog/randv2#principles) section. I think the practice of `path/to/package/v2` should be extensible outside of Go Standard Library.

Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
  • Jonathan Amsterdam
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Holds
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: If64c5402d03290cdab9b3ac922c8efaaec8940e1
Gerrit-Change-Number: 811820
Gerrit-PatchSet: 4
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
Gerrit-Attention: Alan Donovan <adon...@google.com>
Gerrit-Comment-Date: Fri, 07 Aug 2026 15:31:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Alex Putman (Gerrit)

unread,
2:14 PM (8 hours ago) 2:14 PM
to Hongxiang Jiang, goph...@pubsubhelper.golang.org, Alan Donovan, golang...@luci-project-accounts.iam.gserviceaccount.com, Jonathan Amsterdam, golang-co...@googlegroups.com
Attention needed from Alan Donovan, Hongxiang Jiang and Jonathan Amsterdam

Alex Putman voted and added 3 comments

Votes added by Alex Putman

Code-Review+1

3 comments

File internal/packagepath/packagepath.go
Line 64, Patchset 4 (Latest):// TrimVersionSuffix removes a trailing "/v2" (etc) suffix from a package or module path.
Alex Putman . unresolved

nit: "any" or "a possible"

Line 70, Patchset 4 (Latest):func TrimVersionSuffix(path string) string {
Alex Putman . unresolved

Kinda feels like this should be apart of the go repo since it actually represents the import variable used for a package path. But that can be moved later if desired.

File internal/packagepath/packagepath_test.go
Line 65, Patchset 4 (Latest):func TestTrimVersionSuffix(t *testing.T) {
Alex Putman . unresolved

In https://go.dev/ref/mod#major-version-suffixes, it mentions the special case for modules in "gopkg.in/".

Would the import of `gopkg.in/yaml.v2` allow users to call it with the ident "yaml" by default? If so, we might want to cover that too.

Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
  • Hongxiang Jiang
  • Jonathan Amsterdam
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Holds
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: If64c5402d03290cdab9b3ac922c8efaaec8940e1
    Gerrit-Change-Number: 811820
    Gerrit-PatchSet: 4
    Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Alex Putman <apu...@golang.org>
    Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
    Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
    Gerrit-Attention: Alan Donovan <adon...@google.com>
    Gerrit-Comment-Date: Fri, 07 Aug 2026 18:14:34 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Hongxiang Jiang (Gerrit)

    unread,
    6:28 PM (4 hours ago) 6:28 PM
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Alan Donovan, Hongxiang Jiang and Jonathan Amsterdam

    Hongxiang Jiang uploaded new patchset

    Hongxiang Jiang uploaded patch set #5 to this change.
    Following approvals got outdated and were removed:
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alan Donovan
    • Hongxiang Jiang
    • Jonathan Amsterdam
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Holds
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: tools
      Gerrit-Branch: master
      Gerrit-Change-Id: If64c5402d03290cdab9b3ac922c8efaaec8940e1
      Gerrit-Change-Number: 811820
      Gerrit-PatchSet: 5
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Hongxiang Jiang (Gerrit)

      unread,
      6:30 PM (4 hours ago) 6:30 PM
      to goph...@pubsubhelper.golang.org, Michael Pratt, Alex Putman, Alan Donovan, golang...@luci-project-accounts.iam.gserviceaccount.com, Jonathan Amsterdam, golang-co...@googlegroups.com
      Attention needed from Alan Donovan, Alex Putman and Jonathan Amsterdam

      Hongxiang Jiang voted and added 3 comments

      Votes added by Hongxiang Jiang

      Commit-Queue+1
      Hold+1

      3 comments

      File internal/packagepath/packagepath.go
      Line 64, Patchset 4:// TrimVersionSuffix removes a trailing "/v2" (etc) suffix from a package or module path.
      Alex Putman . resolved

      nit: "any" or "a possible"

      Hongxiang Jiang

      Done

      Line 70, Patchset 4:func TrimVersionSuffix(path string) string {
      Alex Putman . resolved

      Kinda feels like this should be apart of the go repo since it actually represents the import variable used for a package path. But that can be moved later if desired.

      Hongxiang Jiang

      When you say "go" repo, you mean golang/go? I think right now, at least for packages, it is not written as a rule yet, if such rule is written, it may be better to move it to go repo.

      Until such is written, keeping it here can keep it "private".

      File internal/packagepath/packagepath_test.go
      Line 65, Patchset 4:func TestTrimVersionSuffix(t *testing.T) {
      Alex Putman . resolved

      In https://go.dev/ref/mod#major-version-suffixes, it mentions the special case for modules in "gopkg.in/".

      Would the import of `gopkg.in/yaml.v2` allow users to call it with the ident "yaml" by default? If so, we might want to cover that too.

      Hongxiang Jiang

      Thank you. I learned something today. Looks like this is old history of go when go support go path mode. I added a TODO here for myself.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alan Donovan
      • Alex Putman
      • Jonathan Amsterdam
      Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Holds
        • requirement satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: tools
        Gerrit-Branch: master
        Gerrit-Change-Id: If64c5402d03290cdab9b3ac922c8efaaec8940e1
        Gerrit-Change-Number: 811820
        Gerrit-PatchSet: 5
        Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
        Gerrit-Reviewer: Alan Donovan <adon...@google.com>
        Gerrit-Reviewer: Alex Putman <apu...@golang.org>
        Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
        Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
        Gerrit-CC: Michael Pratt <mpr...@google.com>
        Gerrit-Attention: Alex Putman <apu...@golang.org>
        Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
        Gerrit-Attention: Alan Donovan <adon...@google.com>
        Gerrit-Comment-Date: Fri, 07 Aug 2026 22:29:57 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Alex Putman <apu...@golang.org>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages