-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
Comments
The rationale for this backport is that the erroneous error message is very confusing, and there is no workaround for confusion. |
Approved. This is a serious issue. |
Change https://golang.org/cl/297989 mentions this issue: |
Change https://golang.org/cl/298010 mentions this issue: |
…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]>
Change https://golang.org/cl/297990 mentions this issue: |
…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]>
…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]>
Closed by merging a9ba734 to release-branch.go1.16. |
@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.
The text was updated successfully, but these errors were encountered: