2019-03-15 13:21:23 -06:00
|
|
|
// +build go1.12
|
|
|
|
|
|
|
|
package imports
|
|
|
|
|
|
|
|
import (
|
2020-02-24 14:46:08 -07:00
|
|
|
"context"
|
2019-03-15 13:21:23 -06:00
|
|
|
"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()
|
2020-02-24 14:46:08 -07:00
|
|
|
if _, err := mt.env.invokeGo(context.Background(), "mod", "download", "rsc.io/quote@v1.5.1"); err != nil {
|
2019-03-15 13:21:23 -06:00
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
mt.assertScanFinds("rsc.io/quote", "quote")
|
|
|
|
}
|