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 download $(go list -m)' fails silently #28338

Open
diplozoon opened this Issue Oct 23, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@diplozoon
Contributor

diplozoon commented Oct 23, 2018

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

go1.11 windows/amd64

Does this issue reproduce with the latest release?

Yes

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

Windows 10, amd64

What did you do?

go mod download doesn't work well when go mod init without version.
(If you run go mod download something.com/something@latest, doesn't work well too.)

What did you expect to see?

Display message (e.g. go mod init: must be set version)

What did you see instead?

Nothing.
Displaying no message isn't user-friendly I think.

@bcmills

This comment has been minimized.

Member

bcmills commented Oct 23, 2018

when go mod init without version.

What do you mean? go mod init does not normally accept a version.

Please post a complete trace of the commands that you ran and the output they produced.

@diplozoon

This comment has been minimized.

Contributor

diplozoon commented Oct 23, 2018

Please excuse my poor English.

The command as follow:

  • go mod init github.com/lib/pq
    • run this, cannot download modules even if run go mod download github.com/lib/pq@latest.
  • go mod init github.com/lib/pq@latest
    • run this, can download modules if run go mod download github.com/lib/pq@latest.

(I tested on Windows 10.)

@bcmills bcmills removed the WaitingForInfo label Oct 23, 2018

@bcmills

This comment has been minimized.

Member

bcmills commented Nov 14, 2018

  • go mod init github.com/lib/pq
    • run this, cannot download modules even if run go mod download github.com/lib/pq@latest.

That may be a bug, but it's a very strange sequence of commands to run.

  • go mod init github.com/lib/pq tells the go command, “this module contains the source code for github.com/lib/pq”.
  • go mod download github.com/lib/pq@latest tells it “download the latest source code for github.com/lib/pq”.

Since the module itself (by its own definition) contains the source code you requested, in some sense go mod download has no work left to do.

  • go mod init github.com/lib/pq@latest

If that command works at all, that's arguably a bug: the @latest is normally a version specification, not part of the module path, but go mod init takes only a module path.

I'll open a separate issue for that.

@bcmills bcmills changed the title from cmd/go: go mod download doesn't work well when go mod init without version to cmd/go: 'go mod download $(go list -m)' fails silently Nov 14, 2018

@bcmills

This comment has been minimized.

Member

bcmills commented Nov 14, 2018

The lack of a useful error message is closely related to #27783.

@bcmills bcmills added NeedsFix and removed NeedsInvestigation labels Nov 14, 2018

@bcmills bcmills modified the milestones: Go1.12, Go1.13 Nov 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment