6 "golang.org/x/tools/internal/lsp"
7 "golang.org/x/tools/internal/testenv"
11 -- golang.org/x/hello@v1.2.3/go.mod --
12 module golang.org/x/hello
15 -- golang.org/x/hello@v1.2.3/hi/hi.go --
21 func TestInconsistentVendoring(t *testing.T) {
22 testenv.NeedsGo1Point(t, 14)
23 const pkgThatUsesVendoring = `
29 require golang.org/x/hello v1.2.3
30 -- vendor/modules.txt --
34 import "golang.org/x/hello/hi"
38 var q int // hardcode a diagnostic
41 // TODO(rstambler): Remove this when golang/go#41819 is resolved.
43 WithModes(WithoutExperiments),
44 WithProxyFiles(basicProxy),
45 ).run(t, pkgThatUsesVendoring, func(t *testing.T, env *Env) {
46 env.OpenFile("a/a1.go")
48 // The editor should pop up a message suggesting that the user
49 // run `go mod vendor`, along with a button to do so.
50 // By default, the fake editor always accepts such suggestions,
51 // so once we see the request, we can assume that `go mod vendor`
54 CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidOpen), 1),
55 ShowMessageRequest("go mod vendor"),
58 env.CheckForFileChanges()
61 CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidChangeWatchedFiles), 1),
62 DiagnosticAt("a/a1.go", 6, 5),