1
0
mirror of https://github.com/golang/go synced 2024-11-05 15:56:12 -07:00
go/internal/imports/mod_112_test.go
Heschi Kreinick c5cec6710e all: consolidate invokeGo implementations
Over time we have accumulated a disturbing number of ways to run the Go
command, each of which supported slightly different features and
workarounds. Combine all of them.

This unavoidably introduces some changes in debug logging behavior; I
think we should try to fix them incrementally and consistently.

Updates golang/go#37368.

Change-Id: I664ca8685bf247a226be3cb807789c2fcddf233d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/220737
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-02-25 21:33:46 +00:00

23 lines
419 B
Go

// +build go1.12
package imports
import (
"context"
"testing"
)
// Tests that we handle GO111MODULE=on with no go.mod file. See #30855.
func TestNoMainModule(t *testing.T) {
mt := setup(t, `
-- x.go --
package x
`, "")
defer mt.cleanup()
if _, err := mt.env.invokeGo(context.Background(), "mod", "download", "rsc.io/quote@v1.5.1"); err != nil {
t.Fatal(err)
}
mt.assertScanFinds("rsc.io/quote", "quote")
}