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

Closed
perillo opened this issue Jan 26, 2020 · 5 comments
Closed
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@perillo
Copy link
Contributor

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
Copy link
Contributor

CL 214381 will address this.

@jayconrod jayconrod added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 27, 2020
@jayconrod jayconrod added this to the Backlog milestone Jan 27, 2020
@perillo
Copy link
Contributor Author

perillo commented Jan 27, 2020

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

@jayconrod
Copy link
Contributor

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

@dmoles
Copy link

dmoles commented Oct 11, 2020

On a related note, the help for go mod help init still says "If possible, init will guess the module path … from version control configuration" even though this functionality seems to have been removed in https://golang.org/cl/172019.

@gopherbot
Copy link

Change https://golang.org/cl/261539 mentions this issue: cmd/go: update 'go help mod init'

@golang golang locked and limited conversation to collaborators Nov 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants