gopls/internal/lsp/protocol: delete $GOROOT hack in URIFromPath
The "$GOROOT" prefix appears literally only in compiler export
data for std, but gopls does not use that.
Change-Id: I50e531d02d8303e15fa7fe27a456d1362e51146d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/543438
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/gopls/internal/lsp/protocol/uri.go b/gopls/internal/lsp/protocol/uri.go
index 5e08cc5..e776d50 100644
--- a/gopls/internal/lsp/protocol/uri.go
+++ b/gopls/internal/lsp/protocol/uri.go
@@ -10,7 +10,6 @@
"fmt"
"net/url"
"path/filepath"
- "runtime"
"strings"
"unicode"
)
@@ -156,14 +155,6 @@
if path == "" {
return ""
}
- // Handle standard library paths that contain the literal "$GOROOT".
- // TODO(rstambler): The go/packages API should allow one to determine a user's $GOROOT.
- // TODO(adonovan): is this still needed? We don't read compiler export data for std.
- const prefix = "$GOROOT"
- if len(path) >= len(prefix) && strings.EqualFold(prefix, path[:len(prefix)]) {
- suffix := path[len(prefix):]
- path = runtime.GOROOT() + suffix
- }
if !isWindowsDrivePath(path) {
if abs, err := filepath.Abs(path); err == nil {
path = abs