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

Open
natefinch opened this Issue Sep 20, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@natefinch
Contributor

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

Contributor

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

Contributor

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

gopherbot 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 from cmd/go: go mod download doesn't do anything if you give it a package without a version to 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.

gopherbot 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment