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: confusing error on mod edit -replace=old=.. #30514

Open
mvdan opened this Issue Mar 1, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@mvdan
Copy link
Member

mvdan commented Mar 1, 2019

What version of Go are you using (go version)?

go version devel +44d3bb998c Fri Mar 1 07:45:00 2019 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What did you do?

$ mkdir test
$ cd test
$ go mod init test
go: creating new go.mod: module test
$ go mod edit -replace=foo.com/bar=..
go mod: -replace=foo.com/bar=..: invalid new path: malformed module path "..": double dot
$ go mod edit -replace=foo.com/bar=../
$ cat go.mod
module test

go 1.13

replace foo.com/bar => ../

What did you expect to see?

Replacing a module to .. would either succeed or give a useful error.

What did you see instead?

An error saying "double dot", which makes no sense to me as a user. It was @myitcv who pointed out that adding a trailing slash would fix the problem.

From go help go mod:

If the @v in new@v is omitted, the new path hould be a local module root directory, not a module path.

So nothing in the error nor the docs seemed to point me at the missing slash.

/cc @bcmills

@mvdan mvdan changed the title cmd/go: confusing error on edit -replace=old=.. cmd/go: confusing error on mod edit -replace=old=.. Mar 1, 2019

@mvdan mvdan added the modules label Mar 1, 2019

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Mar 1, 2019

Possibly related to #27299.

CC @jayconrod

@bcmills bcmills added this to the Go1.13 milestone Mar 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.