Skip to content

Commit 8a9a893

Browse files
committed
internal/lsp/cache: don't set tempModFile is view's modURI is empty
This fixes panics caused by us thinking that we should use tempModFile without a go.mod in the view. This code will likely go away after view.modURI is deleted. Change-Id: I77a9c9f62bcac27cafa69eb970e004dd58d29d07 Reviewed-on: https://go-review.googlesource.com/c/tools/+/257201 Trust: Rebecca Stambler <[email protected]> Run-TryBot: Rebecca Stambler <[email protected]> Reviewed-by: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent 0f1c539 commit 8a9a893

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/lsp/cache/view.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ func determineWorkspaceMode(options *source.Options, validBuildConfiguration boo
10691069
mode |= moduleMode
10701070
}
10711071
// The -modfile flag is available for Go versions >= 1.14.
1072-
if options.TempModfile && ws.goversion >= 14 {
1072+
if ws.modURI != "" && options.TempModfile && ws.goversion >= 14 {
10731073
mode |= tempModfile
10741074
}
10751075
// Don't default to multi-workspace mode if one of the modules contains a

0 commit comments

Comments
 (0)