diff --git a/go/packages/packages_test.go b/go/packages/packages_test.go index bd86d95a..c9d07926 100644 --- a/go/packages/packages_test.go +++ b/go/packages/packages_test.go @@ -930,6 +930,12 @@ func testNewPackagesInOverlay(t *testing.T, exporter packagestest.Exporter) { "b/b.go": `package b; import "golang.org/fake/c"; const B = "b" + c.C`, "c/c.go": `package c; const C = "c"`, "d/d.go": `package d; const D = "d"`, + + // TODO: Remove these temporary files when golang.org/issue/33157 is resolved. + filepath.Join("e/e_temp.go"): ``, + filepath.Join("f/f_temp.go"): ``, + filepath.Join("g/g_temp.go"): ``, + filepath.Join("h/h_temp.go"): ``, }}}) defer exported.Cleanup() @@ -986,7 +992,11 @@ func testNewPackagesInOverlay(t *testing.T, exporter packagestest.Exporter) { } { exported.Config.Overlay = test.overlay exported.Config.Mode = packages.LoadAllSyntax - initial, err := packages.Load(exported.Config, "golang.org/fake/e") + exported.Config.Logf = t.Logf + + // With an overlay, we don't know the expected import path, + // so load with the absolute path of the directory. + initial, err := packages.Load(exported.Config, filepath.Join(dir, "e")) if err != nil { t.Error(err) continue diff --git a/internal/lsp/testdata/nodisk/empty b/internal/lsp/testdata/nodisk/empty index 2cecac2c..0c10a42f 100644 --- a/internal/lsp/testdata/nodisk/empty +++ b/internal/lsp/testdata/nodisk/empty @@ -1 +1 @@ -an empty file so that the directory exists \ No newline at end of file +an empty file so that this directory exists \ No newline at end of file diff --git a/internal/lsp/testdata/nodisk/newdisk_exists.go b/internal/lsp/testdata/nodisk/newdisk_exists.go new file mode 100644 index 00000000..cf2bdf3d --- /dev/null +++ b/internal/lsp/testdata/nodisk/newdisk_exists.go @@ -0,0 +1 @@ +TODO: Remove this file when golang.org/issue/33157 is resolved. \ No newline at end of file diff --git a/internal/lsp/testdata/nodisk/nodisk_exists.go b/internal/lsp/testdata/nodisk/nodisk_exists.go deleted file mode 100644 index fbccebdf..00000000 --- a/internal/lsp/testdata/nodisk/nodisk_exists.go +++ /dev/null @@ -1,3 +0,0 @@ -package nodisk - -//TODO: remove this file when https://github.com/golang/go/issues/33125 is fixed. \ No newline at end of file diff --git a/internal/lsp/tests/tests.go b/internal/lsp/tests/tests.go index 4f09d720..767d8175 100644 --- a/internal/lsp/tests/tests.go +++ b/internal/lsp/tests/tests.go @@ -195,10 +195,12 @@ func Load(t testing.TB, exporter packagestest.Exporter, dir string) *Data { filename := data.Exported.File(testModule, fragment) data.fragments[filename] = fragment } + data.Exported.Config.Logf = t.Logf // Merge the exported.Config with the view.Config. data.Config = *data.Exported.Config data.Config.Fset = token.NewFileSet() + data.Config.Logf = t.Logf data.Config.Context = Context(nil) data.Config.ParseFile = func(fset *token.FileSet, filename string, src []byte) (*ast.File, error) { panic("ParseFile should not be called")