Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: malformed module path with retract v2+ [1.16 backport] #44496

Closed
gopherbot opened this issue Feb 22, 2021 · 7 comments
Closed

cmd/go: malformed module path with retract v2+ [1.16 backport] #44496

gopherbot opened this issue Feb 22, 2021 · 7 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link
Contributor

gopherbot commented Feb 22, 2021

@bcmills requested issue #44494 (fixed by bcac57f and 5fafc0b in Go 1.17) to be considered for backport to the next 1.16 minor release.

@gopherbot, please backport to Go 1.16.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Feb 22, 2021
@gopherbot gopherbot added this to the Go1.16.1 milestone Feb 22, 2021
@bcmills
Copy link
Contributor

bcmills commented Feb 22, 2021

The rationale for this backport is that the erroneous error message is very confusing, and there is no workaround for confusion.

@cagedmantis
Copy link
Contributor

Approved. This is a serious issue.

@cagedmantis cagedmantis added the CherryPickApproved Used during the release process for point releases label Feb 25, 2021
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Feb 25, 2021
@gopherbot
Copy link
Contributor Author

Change https://golang.org/cl/297989 mentions this issue: [release-branch.go1.16] cmd/go/internal/modload: don't query when fixing canonical versions

@gopherbot
Copy link
Contributor Author

Change https://golang.org/cl/298010 mentions this issue: [internal-branch.go1.16-vendor] modfile: defer fixing versions in retract directives

gopherbot pushed a commit to golang/mod that referenced this issue Mar 2, 2021
…ract directives

VersionFixers require both a path and a version: if the version is
non-canonical (like a branch name), they generally need the path to
look up the proper version. This is fine for require, replace, and
exclude directives, since the path is specified with each version. For
retract directives, the path comes from the module directive, which
may appear later in the file. Previously, we just used the empty
string, but this breaks reasonable implementations.

With this change, we leave retracted versions alone until the file has
been completely parsed, then we apply the version fixer to each
retract directive. We report an error if retract is used without a
module directive.

For golang/go#44496

Change-Id: I99b7b8b55941c1fde4ee56161acfe854bcaf948d
Reviewed-on: https://go-review.googlesource.com/c/mod/+/296130
Trust: Jay Conrod <[email protected]>
Run-TryBot: Jay Conrod <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Bryan C. Mills <[email protected]>
(cherry picked from commit 66bf157)
Reviewed-on: https://go-review.googlesource.com/c/mod/+/298010
Reviewed-by: Dmitri Shuralyov <[email protected]>
@gopherbot
Copy link
Contributor Author

Change https://golang.org/cl/297990 mentions this issue: [release-branch.go1.16] cmd: upgrade golang.org/x/mod to fix go.mod parser

gopherbot pushed a commit that referenced this issue Mar 3, 2021
…arser

modfile.Parse passed an empty string to the VersionFixer for the
module path. This caused errors for v2+ versions.

For #44496

Change-Id: I13b86b6ecf6815c4bc9a96ec0668284c9228c205
Reviewed-on: https://go-review.googlesource.com/c/go/+/296131
Trust: Jay Conrod <[email protected]>
Run-TryBot: Jay Conrod <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Bryan C. Mills <[email protected]>
(cherry picked from commit bcac57f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/297990
Reviewed-by: Dmitri Shuralyov <[email protected]>
gopherbot pushed a commit that referenced this issue Mar 3, 2021
…ing canonical versions

If a canonical version is passed to fixVersion when loading the main
go.mod and that version don't match the module path's major version
suffix, don't call Query.

Query doesn't return a useful error in this case when the path is
malformed, for example, when it doens't have a dot in the first path
element. It's better to report the major version mismatch error.

Fixes #44496

Change-Id: I97b1f64aee894fa0db6fb637aa03a51357ee782c
Reviewed-on: https://go-review.googlesource.com/c/go/+/296590
Trust: Jay Conrod <[email protected]>
Run-TryBot: Jay Conrod <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Bryan C. Mills <[email protected]>
(cherry picked from commit 5fafc0b)
Reviewed-on: https://go-review.googlesource.com/c/go/+/297989
Reviewed-by: Dmitri Shuralyov <[email protected]>
@gopherbot
Copy link
Contributor Author

Closed by merging a9ba734 to release-branch.go1.16.

@gopherbot

This comment has been minimized.

@toothrot toothrot modified the milestones: Go1.16.1, Go1.16.2 Mar 10, 2021
@golang golang locked and limited conversation to collaborators Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

4 participants