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: document that `go mod init` can guess the module path when inside GOPATH #36775

Open
perillo opened this issue Jan 26, 2020 · 3 comments
Open

Comments

@perillo
Copy link

@perillo perillo commented Jan 26, 2020

go mod help init says:

If possible, init will guess the module path from import comments
(see 'go help importpath') or from version control configuration.

However when calling go mod init (on an empty project) inside $GOPATH, the module path is correctly guessed.

On the other hand, when go mod init is called outside $GOPATH, it reports an error:

go: cannot determine module path for source directory /tmp/go/test (outside GOPATH, module path must be specified)

This is not documented.

@jayconrod

This comment has been minimized.

Copy link
Contributor

@jayconrod jayconrod commented Jan 27, 2020

CL 214381 will address this.

@jayconrod jayconrod added the NeedsFix label Jan 27, 2020
@jayconrod jayconrod added this to the Backlog milestone Jan 27, 2020
@perillo

This comment has been minimized.

Copy link
Author

@perillo perillo commented Jan 27, 2020

CL 214381 should also update the original documentation of the go mod command.

@jayconrod

This comment has been minimized.

Copy link
Contributor

@jayconrod jayconrod commented Jan 27, 2020

@perillo The main issue for module documentation is #33637.

When the module reference documentation is complete, we'll re-evaluate the go help documentation. I would like the module reference documentation to be the canonical reference for most of these topics. go help would just show brief summaries of commands and flags. It's hard to read this kind of reference documentation in the terminal without links or formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.