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: go mod edit -replace does not accept a module path without a dot #30513

Open
neclepsio opened this issue Mar 1, 2019 · 3 comments

Comments

Projects
None yet
5 participants
@neclepsio
Copy link

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

This comment has been minimized.

Copy link
Member

commented Mar 1, 2019

/cc @bcmills

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

@bcmills

This comment has been minimized.

Copy link
Member

commented Mar 14, 2019

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

@iWdGo

This comment has been minimized.

Copy link
Contributor

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.

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.