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 init . creates a module called . #32644

Closed
davecheney opened this issue Jun 17, 2019 · 3 comments
Closed

cmd/go: go mod init . creates a module called . #32644

davecheney opened this issue Jun 17, 2019 · 3 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@davecheney
Copy link
Contributor

davecheney commented Jun 17, 2019

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

% go version
go version devel +b388d6868f Thu Jun 13 03:58:18 2019 +0000 darwin/amd64

Does this issue reproduce with the latest release?

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

go env Output
$ go env

What did you do?

(~/src/d) % go mod init .
go: creating new go.mod: module .
(~/src/d) % ls
go.mod  main.go
(~/src/d) % cat go.mod 
module .

go 1.13

What did you expect to see?

My gopath is set to ~/src, tf. the modules name should be d.

What did you see instead?

The module is called . which is not valid

(~/src/d) % go test
build _/Users/dfc/src/d: cannot find module for path _/Users/dfc/src/d
(~/src/d) % 
@gopherbot
Copy link

Change https://golang.org/cl/182560 mentions this issue: cmd/go: validate path in mod init path

@cuonglm
Copy link
Member

cuonglm commented Jun 17, 2019

@davecheney I think expected should be an error, . is not a valid module path (emphasis by me):

$ go help mod init
usage: go mod init [module]

Init initializes and writes a new go.mod to the current directory,
in effect creating a new module rooted at the current directory.
The file go.mod must not already exist.
If possible, init will guess the module path from import comments
(see 'go help importpath') or from version control configuration.
To override this guess, supply the module path as an argument.

@katiehockman
Copy link
Contributor

/cc @bcmills

@katiehockman katiehockman added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 17, 2019
@jayconrod jayconrod added this to the Go1.14 milestone Jun 17, 2019
@golang golang locked and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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

5 participants