Skip to content

cmd/go: go mod edit -replace does not accept a module path without a dot #30513

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

Closed
neclepsio opened this issue Mar 1, 2019 · 4 comments
Closed
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@neclepsio
Copy link

neclepsio commented Mar 1, 2019

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

$ go version
go version go1.12 windows/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPROXY=
set GORACE=
set GOTMPDIR=

What did you do?

go mod edit -replace=foo=bar

What did you expect to see?

Adding a replace into go.mod, since if it is added manually there is no problem.

What did you see instead?

go mod: -replace=foo=bar: invalid old path: malformed module path "foo": missing dot in first path element
@bradfitz bradfitz changed the title go mod edit -replace does not accept a module path without a dot cmd/go: go mod edit -replace does not accept a module path without a dot Mar 1, 2019
@bradfitz
Copy link
Contributor

bradfitz commented Mar 1, 2019

/cc @bcmills

@bradfitz bradfitz 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
@bradfitz bradfitz added this to the Go1.13 milestone Mar 1, 2019
@bcmills
Copy link
Contributor

bcmills commented Mar 14, 2019

This is somewhat related to #28439, in that we're over-validating inputs to mod edit.

@bcmills bcmills added modules NeedsFix The path to resolution is known, but the work has not been done. labels Apr 13, 2019
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 13, 2019
@iwdgo
Copy link
Contributor

iwdgo commented Jun 16, 2019

This issue and partly the related ones are caused by CheckPath which was originally a copy of the path strategy of go get as this comment mentions.

go mod edit aim is to edit go.mod and not to check existence of modules. Since the Windows checks are not included between others, it seems appropriate to remove the requirement of a leading . in the path name.

Further, this check is redundant with IsDirectoryPath which draws the line between paths and module paths.

@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/210343 mentions this issue: cmd/go/internal/modcmd: loosen path validation in "go mod edit"

@bcmills bcmills self-assigned this Dec 6, 2019
@golang golang locked and limited conversation to collaborators Dec 5, 2020
@rsc rsc unassigned bcmills Jun 23, 2022
@dmitshur dmitshur modified the milestones: Backlog, Go1.14 Jun 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

8 participants