From 7099162a900ae8260c5b97cfaf5f374243dfa742 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Mon, 9 Nov 2020 20:51:46 -0500 Subject: [PATCH] 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 gopls-CI: kokoro TryBot-Result: Go Bot Trust: Robert Findley Reviewed-by: Heschi Kreinick --- internal/lsp/cache/workspace.go | 5 ----- internal/lsp/general.go | 6 ------ internal/lsp/semantic.go | 2 -- 3 files changed, 13 deletions(-) diff --git a/internal/lsp/cache/workspace.go b/internal/lsp/cache/workspace.go index 4d05adc5eb..efaa38cafc 100644 --- a/internal/lsp/cache/workspace.go +++ b/internal/lsp/cache/workspace.go @@ -308,11 +308,6 @@ func isGoMod(uri span.URI) bool { 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 620140c91f..3b940b827f 100644 --- a/internal/lsp/general.go +++ b/internal/lsp/general.go @@ -13,7 +13,6 @@ import ( "os" "path" "path/filepath" - "strings" "sync" "golang.org/x/tools/internal/event" @@ -409,11 +408,6 @@ func (s *Server) registerWatchedDirectoriesLocked(ctx context.Context, dirs map[ 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 b669fabaff..48700d2c58 100644 --- a/internal/lsp/semantic.go +++ b/internal/lsp/semantic.go @@ -126,8 +126,6 @@ const ( 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")