[gopls-release-branch.0.18] gopls/internal/settings: fix misleading error messages
The deprecatedError helper constructs a specifically formatted error
string suggesting a replacement. Certain deprecations were misusing the
API, resulting in nonsensical error messages.
Change-Id: Ic72bf608b5b2e97baf75c192a49fd4181d7800b2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/651695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
(cherry picked from commit 5299dcb7277190caeca1a827cb7d5c856b22f37f)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/651696
Auto-Submit: Robert Findley <rfindley@google.com>
diff --git a/gopls/internal/settings/settings.go b/gopls/internal/settings/settings.go
index b7aa7d2..8b8c51b 100644
--- a/gopls/internal/settings/settings.go
+++ b/gopls/internal/settings/settings.go
@@ -1116,7 +1116,7 @@
return nil, err
}
if o.Analyses["fieldalignment"] {
- return counts, deprecatedError("the 'fieldalignment' analyzer was removed in gopls/v0.17.0; instead, hover over struct fields to see size/offset information (https://go.dev/issue/66861)")
+ return counts, &SoftError{"the 'fieldalignment' analyzer was removed in gopls/v0.17.0; instead, hover over struct fields to see size/offset information (https://go.dev/issue/66861)"}
}
return counts, nil
@@ -1124,7 +1124,7 @@
return setBoolMap(&o.Hints, value)
case "annotations":
- return nil, deprecatedError("the 'annotations' setting was removed in gopls/v0.18.0; all compiler optimization details are now shown")
+ return nil, &SoftError{"the 'annotations' setting was removed in gopls/v0.18.0; all compiler optimization details are now shown"}
case "vulncheck":
return setEnum(&o.Vulncheck, value,