gopls/internal/lsp/cache: request EmbedFiles from go/packages Gopls attempts to diagnose incorrect embed patterns. The logic to do so relies on 'go list' to actually resolve those patterns and to propagate an error in case the pattern is incorrect, see also [1]. Gopls explicitly specifies the needed JSON fields towards 'go list -json' which internally skips evaluation steps for unneeded fields. Currently, the embed patterns are always evaluated but there is plans to only run pattern evaluation if needed [2]. So, explicitly ask for EmbedFiles to prepare for [2]. [1]: https://github.com/golang/tools/blob/193023cca0b707b4d668e5d332649cba285e99f7/gopls/internal/regtest/misc/embed_test.go#L26-L40 [2]: https://github.com/golang/go/pull/58522 Change-Id: I615cd5076659f192d884504ab735ce77b6e0e129 GitHub-Last-Rev: 9c1addbf9f26233dbe31c08fd98335bfd6aa1062 GitHub-Pull-Request: golang/tools#428 Reviewed-on: https://go-review.googlesource.com/c/tools/+/470157 Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/gopls/internal/lsp/cache/snapshot.go b/gopls/internal/lsp/cache/snapshot.go index ab42556..d0885f0 100644 --- a/gopls/internal/lsp/cache/snapshot.go +++ b/gopls/internal/lsp/cache/snapshot.go
@@ -385,6 +385,7 @@ packages.NeedDeps | packages.NeedTypesSizes | packages.NeedModule | + packages.NeedEmbedFiles | packages.LoadMode(packagesinternal.DepsErrors) | packages.LoadMode(packagesinternal.ForTest), Fset: nil, // we do our own parsing