From 962260a67897f4f8b2bb2ed42969dc83f7262eb0 Mon Sep 17 00:00:00 2001 From: Robert Findley Date: Tue, 1 Feb 2022 11:59:45 -0500 Subject: [PATCH] internal/lsp/source: remove the unused source.DetectLanguage Change-Id: If146b609f7dbf019cb11b27c73d685bcaf5a5075 Reviewed-on: https://go-review.googlesource.com/c/tools/+/382236 Trust: Robert Findley Run-TryBot: Robert Findley Reviewed-by: Peter Weinberger gopls-CI: kokoro TryBot-Result: Gopher Robot --- internal/lsp/source/util.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/internal/lsp/source/util.go b/internal/lsp/source/util.go index 443bda8eec..56974f22d1 100644 --- a/internal/lsp/source/util.go +++ b/internal/lsp/source/util.go @@ -178,25 +178,6 @@ func FileKindForLang(langID string) FileKind { } } -func DetectLanguage(langID, filename string) FileKind { - // use the langID if the client sent it - if kind := FileKindForLang(langID); kind != UnknownKind { - return kind - } - // Detect the language based on the file extension. - switch ext := filepath.Ext(filename); ext { - case ".mod": - return Mod - case ".sum": - return Sum - case ".go": - return Go - default: - // (for instance, before go1.15 cgo files had no extension) - return Go - } -} - func (k FileKind) String() string { switch k { case Go: