]> Cypherpunks repositories - gostls13.git/commit
cmd/go: add regression test for cryptic vcs errors
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 20 Dec 2018 23:04:18 +0000 (00:04 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Sat, 22 Dec 2018 09:37:04 +0000 (09:37 +0000)
commit97d5cb24b10b7b740de2f1cc04d88341c4437ae0
tree2b72c8af559c4d05e861760bc87e4bf13477cc93
parent3a3b98fdf96a93191d6c14f3b3cd2b757b961ec0
cmd/go: add regression test for cryptic vcs errors

On Go 1.11.x, if one ran 'go build' on a main package within a module,
while a needed vcs program like git was missing, a confusing error would
show up:

build testmod: cannot find module for path rsc.io/quote

The error should instead point at the source of the problem, which is
the missing vcs program. Thankfully, Go 1.12 doesn't have this bug, even
though it doesn't seem like the bug was fixed directly and
intentionally.

To ensure that this particular edge case isn't broken again, add a
regression test. Piggyback on mod_vcs_missing, since it already requires
a missing vcs program and network access.

I double-checked that Go 1.11 fails this test via /usr/bin/go, which is
1.11.3 on my system:

$ PATH=~/tip/bin go test -v -run Script/mod_vcs_missing
[...]
> exec /usr/bin/go build
[stderr]
build m: cannot find module for path launchpad.net/gocheck

Fixes #28948.

Change-Id: Iff1bcf77d9f7c11d15935cb87d6f58d7981d33d2
Reviewed-on: https://go-review.googlesource.com/c/155537
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/testdata/script/mod_vcs_missing.txt