1
0
mirror of https://github.com/golang/go synced 2024-11-22 20:24:47 -07:00

cmd/go: add a regression test for #45979

Change-Id: Id7f83b2e6a99af798e55b272b04880ebb588351f
Reviewed-on: https://go-review.googlesource.com/c/go/+/328230
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Bryan C. Mills 2021-06-11 16:39:54 -04:00
parent a294e4e798
commit 6ea2af0890

View File

@ -0,0 +1,38 @@
# https://golang.org/issue/45979: after 'go get' on a package,
# that package should be importable without error.
# We start out with an unresolved dependency.
# 'go list' suggests that we run 'go get' on that dependency.
! go list -deps .
stderr '^m.go:3:8: no required module provides package rsc\.io/quote; to add it:\n\tgo get rsc.io/quote$'
# Unfortunately, the suggested 'go get' command leaves us with another problem.
#
# TODO(#45979): After 'go get', the 'go list' command from above should succeed.
go get rsc.io/quote
! go list -deps .
stderr '^go: updates to go.mod needed; to update it:\n\tgo mod tidy'
[!short] ! go build .
stderr '^go: updates to go.mod needed; to update it:\n\tgo mod tidy'
# After running the suggested 'go mod tidy' command, the build
# should succeed.
go mod tidy
go list -deps .
[!short] go build .
-- go.mod --
module example.com/m
go 1.17
-- m.go --
package m
import _ "rsc.io/quote"