internal/lsp: remove dead code
Running `staticcheck ./internal/lsp/...` turned up a few instances of
dead code. Remove them.
Change-Id: Ic53db59cd0959fad960b086158eb550a624a4d91
Reviewed-on: https://go-review.googlesource.com/c/tools/+/268580
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
diff --git a/internal/lsp/cache/workspace.go b/internal/lsp/cache/workspace.go
index 4d05adc..efaa38c 100644
--- a/internal/lsp/cache/workspace.go
+++ b/internal/lsp/cache/workspace.go
@@ -308,11 +308,6 @@
return filepath.Base(uri.Filename()) == "go.mod"
}
-// isGoMod reports if uri is a go.sum file.
-func isGoSum(uri span.URI) bool {
- return filepath.Base(uri.Filename()) == "go.sum"
-}
-
// fileExists reports if the file uri exists within source.
func fileExists(ctx context.Context, uri span.URI, source source.FileSource) (bool, error) {
fh, err := source.GetFile(ctx, uri)
diff --git a/internal/lsp/general.go b/internal/lsp/general.go
index 620140c..3b940b8 100644
--- a/internal/lsp/general.go
+++ b/internal/lsp/general.go
@@ -13,7 +13,6 @@
"os"
"path"
"path/filepath"
- "strings"
"sync"
"golang.org/x/tools/internal/event"
@@ -409,11 +408,6 @@
return nil
}
-func isSubdirectory(root, leaf string) bool {
- rel, err := filepath.Rel(root, leaf)
- return err == nil && !strings.HasPrefix(rel, "..")
-}
-
func (s *Server) fetchConfig(ctx context.Context, name string, folder span.URI, o *source.Options) error {
if !s.session.Options().ConfigurationSupported {
return nil
diff --git a/internal/lsp/semantic.go b/internal/lsp/semantic.go
index b669fab..48700d2 100644
--- a/internal/lsp/semantic.go
+++ b/internal/lsp/semantic.go
@@ -126,8 +126,6 @@
tokOperator tokenType = "operator"
)
-var lastPosition token.Position
-
func (e *encoded) token(start token.Pos, leng int, typ tokenType, mods []string) {
if start == 0 {
e.unexpected("token at token.NoPos")