go: cmd/go: get fails to provide sensible error message for private vcs repos

What did you do?

I have a project that imports a private git repository. When setting it up with vgo get or similar commands, the resolving process will stop abruptly, not writing anything to the disk.

The command succeeds if git credentials are properly set up (*_ASKPASS, global config or the repo is already cloned with the right config, etc.).

What did you expect to see?

An error message, or some indication of what went wrong

What did you see instead?

No error message, just an exit code 1.

System details

go version go1.10.3 linux/amd64 vgo:2018-02-20.1
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/exploser/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/exploser/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build534162883=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.10.3 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.10.3
uname -sr: Linux 4.16.14-2-MANJARO
LSB Version:	n/a
Distributor ID:	ManjaroLinux
Description:	Manjaro Linux
Release:	17.1.10
Codename:	Hakoila
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.27.
gdb --version: GNU gdb (GDB) 8.1

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 8
  • Comments: 16 (12 by maintainers)

Commits related to this issue

Most upvoted comments

So just to summarise what I think the action is here, we need any of the go commands that end up doing anything with a VCS remote (via the corresponding tool), e.g. git ls-remote -q https://github.com/overhq/over-stories-api, to print to stderr the output from the tool in case of a non-zero exit code.

go get is not currently silent (I’ll update the issue title) it’s just that its output is misleading (comment true as of a9dcbab0fd)

So, taking the example of github.com/overhq/over-stories-api, the current behaviour is:

$ go get github.com/overhq/over-stories-api
go get github.com/overhq/over-stories-api: cannot find module providing package github.com/overhq/over-stories-api

We should instead see something like:

$ go get github.com/overhq/over-stories-api
remote: Repository not found.
fatal: repository 'https://github.com/overhq/over-stories-api/' not found

Just read https://golang.org/doc/faq#git_https and that fixes things for me! Thanks for pointing me in the right direction @myitcv