From 51f179cad1fb92b2d4761e6596623eaa49ff0a35 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Fri, 31 Jan 2025 18:01:59 +0000 Subject: [PATCH] gopls/internal/golang: downgrade bug report in ExtractToNewFile While we shouldn't serve 'extract' code actions containing an invalid range, we also as a matter of principle should not report bugs for invalid commands from the client, even if for well-behaved clients they should only originate from our own code action. In other words, this could easily be a manifestation of a client bug, and we should focus our attention on certain gopls bugs. Fixes golang/go#71473 Change-Id: Id740d03e5043dc17c6ed50a9f9c767f9de445ed5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/645875 Reviewed-by: Alan Donovan LUCI-TryBot-Result: Go LUCI --- gopls/internal/golang/extracttofile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gopls/internal/golang/extracttofile.go b/gopls/internal/golang/extracttofile.go index cda9cd51e6d..39fb28e624b 100644 --- a/gopls/internal/golang/extracttofile.go +++ b/gopls/internal/golang/extracttofile.go @@ -95,7 +95,7 @@ func ExtractToNewFile(ctx context.Context, snapshot *cache.Snapshot, fh file.Han start, end, firstSymbol, ok := selectedToplevelDecls(pgf, start, end) if !ok { - return nil, bug.Errorf("invalid selection") + return nil, fmt.Errorf("invalid selection") } pgf.CheckPos(start) // #70553 // Inv: start is valid wrt pgf.Tok.