-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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+ #44494
Comments
I had reported a slight variant of this in gophers slack, where I was trying to retract a version 2 while the module is still in version 0. repro:
The error message I got is;
Seankhliao pointed out it should not be possible to retract a v2 while still in v0. |
@gopherbot, please backport to Go 1.16. |
Backport issue(s) opened: #44496 (for 1.16). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/296130 mentions this issue: |
Change https://golang.org/cl/296131 mentions this issue: |
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#44494 Change-Id: I99b7b8b55941c1fde4ee56161acfe854bcaf948d Reviewed-on: https://go-review.googlesource.com/c/mod/+/296130 Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
@jayconrod Thanks for working on & closing this. mkdir -p /tmp/example; cd /tmp/example; gotip mod init example
rm -rf main.go
tee -a main.go <<EOF
package main
func main(){println("hello")}
EOF
rm -rf go.mod
tee -a go.mod <<EOF
module example
go 1.17
retract v2.0.2
EOF
gotip mod tidy
I still think this error message could be better. |
Change https://golang.org/cl/296590 mentions this issue: |
@jayconrod gotip version
go version devel +e25040d Fri Feb 26 02:52:33 2021 +0000 darwin/amd64 and the error I now get is;
|
@komuw, we're getting closer, then! The real problem now, I think, is that it is not possible to But we still need a better error message for that case. 🙂 |
@jayconrod Thanks for fixing the error message. The |
Apologies, I just realised I was running
using |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
add a retract directive to a v2+ module and run
go mod tidy
What did you expect to see?
no error
What did you see instead?
» go mod tidy go: errors parsing go.mod: /home/arccy/testrepo-291/go.mod:5: malformed module path "": empty string
The text was updated successfully, but these errors were encountered: