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 download doesn't do anything if you give it a module without a version #27783

Closed
natefinch opened this issue Sep 20, 2018 · 7 comments

Comments

Projects
None yet
5 participants
@natefinch
Copy link
Contributor

commented Sep 20, 2018

So, I didn't realize that go mod download required an @version at the end... I presumed it would default to @latest just like it would if you import a library without specifying a version in your go.mod. However, instead, go mod download just silently fails.

What did you do?

(in a directory outside GOPATH with a go.mod that did not include github.com/lib/pq)
go mod download github.com/lib/pq

What did you expect to see?

some version of lib/pq downloaded, or an error

What did you see instead?

nothing happened and no error

System details

go version go1.11 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/finchnat/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/finchnat"
GOPROXY=""
GORACE=""
GOROOT="/Users/finchnat/sdk/go1.11"
GOTMPDIR=""
GOTOOLDIR="/Users/finchnat/sdk/go1.11/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/finchnat/dev/test/go.mod"
GOROOT/bin/go version: go version go1.11 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.11
uname -v: Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G65
lldb --version: lldb-902.0.79.7
  Swift-4.1
@natefinch

This comment has been minimized.

Copy link
Contributor Author

commented Sep 20, 2018

Notably, I'd prefer "no version" to default to @latest ... but it at the very least should tell me I gave it something invalid.

@bcmills bcmills added the NeedsFix label Sep 22, 2018

@bcmills bcmills added this to the Go1.12 milestone Sep 22, 2018

@bcmills bcmills added the modules label Sep 22, 2018

@hyangah

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2018

'go mod download' should report errors and failure if any.

$ go mod download somethingveryfake.com/fake
$
@gopherbot

This comment has been minimized.

Copy link

commented Oct 23, 2018

Change https://golang.org/cl/144106 mentions this issue: cmd/go/internal/modcmd: warn when no version supplied to go mod download

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

@bcmills bcmills changed the title cmd/go: go mod download doesn't do anything if you give it a package without a version cmd/go: go mod download doesn't do anything if you give it a module without a version Nov 15, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Nov 28, 2018

Change https://golang.org/cl/151559 mentions this issue: cmd/go/internal/modcmd: check for errors in Download

gopherbot pushed a commit that referenced this issue Nov 29, 2018

cmd/go/internal/modcmd: check for errors in Download
Also test that Download restores deleted files.

Updates #27783

Change-Id: If50074dbcffd74ff08fbaa9ad8c314cfdce0b02d
Reviewed-on: https://go-review.googlesource.com/c/151559
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
@gopherbot

This comment has been minimized.

Copy link

commented May 4, 2019

Change https://golang.org/cl/174697 mentions this issue: cmd/go: fix error message for go mod in GOPATH mode

@iWdGo

This comment has been minimized.

Copy link
Contributor

commented May 4, 2019

Issue is related to #31237, an error message displays with the submitted fix which seems to solve the issue:

$GOPATH\src\mymod>set GO111MODULE=on

$GOPATH\src\mymod>goissue mod download rsc.io/doesnotexist
go: cannot find main module; see 'go help modules'
@gopherbot

This comment has been minimized.

Copy link

commented Jun 2, 2019

Change https://golang.org/cl/179998 mentions this issue: cmd/go: fix error messages for go mod download in GOPATH mode

@gopherbot gopherbot closed this in 5587e05 Jun 7, 2019

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