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

Comments

@davecheney
Copy link
Contributor

@davecheney 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

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jun 17, 2019

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

@cuonglm

This comment has been minimized.

Copy link
Contributor

@cuonglm 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

This comment has been minimized.

Copy link
Member

@katiehockman katiehockman commented Jun 17, 2019

/cc @bcmills

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.