From eb7c56241bdbe0c71173299666df6ddce273e75b Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Wed, 26 Feb 2020 14:11:56 -0500 Subject: [PATCH] internal/lsp: remove unknown dependency from highlight tests The highlight tests imported golang.org/x/tools/internal/lsp/protocol package, which doesn't exist when the testdata is set up in the test harness. This causes gopls to try to reload the metadata for the package. I'm not sure why this wasn't an issue before, since we should re-run go/packages.Load every time we have missing dependencies. Fixes golang/go#37365 Change-Id: I8ebcbbf78b7e6fcdac9ab83bef3f5a0c9a50a361 Reviewed-on: https://go-review.googlesource.com/c/tools/+/221107 Run-TryBot: Rebecca Stambler TryBot-Result: Gobot Gobot Reviewed-by: Rohan Challa Reviewed-by: Robert Findley --- .../testdata/lsp/primarymod/highlights/highlights.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/internal/lsp/testdata/lsp/primarymod/highlights/highlights.go b/internal/lsp/testdata/lsp/primarymod/highlights/highlights.go index de67efec2c..db09b5650b 100644 --- a/internal/lsp/testdata/lsp/primarymod/highlights/highlights.go +++ b/internal/lsp/testdata/lsp/primarymod/highlights/highlights.go @@ -4,8 +4,6 @@ import ( "fmt" //@mark(fmtImp, "\"fmt\""),highlight(fmtImp, fmtImp, fmt1, fmt2, fmt3, fmt4) h2 "net/http" //@mark(hImp, "h2"),highlight(hImp, hImp, hUse) "sort" - - "golang.org/x/tools/internal/lsp/protocol" ) type F struct{ bar int } //@mark(barDeclaration, "bar"),highlight(barDeclaration, barDeclaration, bar1, bar2, bar3) @@ -35,12 +33,10 @@ func testFunctions() { Print() //@mark(printTest, "Print"),highlight(printTest, printFunc, printTest) } -func toProtocolHighlight(rngs []protocol.Range) []protocol.DocumentHighlight { //@mark(doc1, "DocumentHighlight"),mark(docRet1, "[]protocol.DocumentHighlight"),highlight(doc1, docRet1, doc1, doc2, doc3, result) - result := make([]protocol.DocumentHighlight, 0, len(rngs)) //@mark(doc2, "DocumentHighlight"),highlight(doc2, doc1, doc2, doc3) - kind := protocol.Text +func toProtocolHighlight(rngs []int) []DocumentHighlight { //@mark(doc1, "DocumentHighlight"),mark(docRet1, "[]DocumentHighlight"),highlight(doc1, docRet1, doc1, doc2, doc3, result) + result := make([]DocumentHighlight, 0, len(rngs)) //@mark(doc2, "DocumentHighlight"),highlight(doc2, doc1, doc2, doc3) for _, rng := range rngs { - result = append(result, protocol.DocumentHighlight{ //@mark(doc3, "DocumentHighlight"),highlight(doc3, doc1, doc2, doc3) - Kind: kind, + result = append(result, DocumentHighlight{ //@mark(doc3, "DocumentHighlight"),highlight(doc3, doc1, doc2, doc3) Range: rng, }) }