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
Open

cmd/go: confusing error on mod edit -replace=old=.. #30514

mvdan opened this issue Mar 1, 2019 · 1 comment
Labels
modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@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 bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 1, 2019
@bcmills
Copy link
Contributor

bcmills commented Mar 1, 2019

Possibly related to #27299.

CC @jayconrod

@bcmills bcmills added this to the Go1.13 milestone Mar 1, 2019
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants