Skip to content

Commit 12b5dad

Browse files
committed
gopls: deprecate "tempModfile" and "expandWorkspaceToModule" settings
These settings deeply affect gopls' behavior, and can't work well when set to a non-default value. More rationale is provided in the attached issues. The features controlled by these settings are not yet removed. For the v0.14.0 release, we will simply warn users who have them set. Fixes golang/go#57514 Fixes golang/go#61970 Change-Id: Ica631dcb8980eeeace9ceaec159218e6306831ae Reviewed-on: https://go-review.googlesource.com/c/tools/+/534919 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
1 parent f85b3f7 commit 12b5dad

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

gopls/internal/lsp/source/options.go

+7
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,7 @@ func (o *Options) set(name string, value interface{}, seen map[string]struct{})
11811181
result.setBool(&o.VerboseWorkDoneProgress)
11821182

11831183
case "tempModfile":
1184+
result.softErrorf("gopls setting \"tempModfile\" is deprecated.\nPlease comment on https://go.dev/issue/63537 if this impacts your workflow.")
11841185
result.setBool(&o.TempModfile)
11851186

11861187
case "showBugReports":
@@ -1207,6 +1208,7 @@ func (o *Options) set(name string, value interface{}, seen map[string]struct{})
12071208
result.setBool(&o.NoSemanticNumber)
12081209

12091210
case "expandWorkspaceToModule":
1211+
result.softErrorf("gopls setting \"expandWorkspaceToModule\" is deprecated.\nPlease comment on https://go.dev/issue/63536 if this impacts your workflow.")
12101212
result.setBool(&o.ExpandWorkspaceToModule)
12111213

12121214
case "experimentalPostfixCompletions":
@@ -1356,6 +1358,11 @@ func (r *OptionResult) deprecated(replacement string) {
13561358
r.Error = &SoftError{msg}
13571359
}
13581360

1361+
// softErrorf reports a soft error related to the current option.
1362+
func (r *OptionResult) softErrorf(format string, args ...any) {
1363+
r.Error = &SoftError{fmt.Sprintf(format, args...)}
1364+
}
1365+
13591366
// unexpected reports that the current setting is not known to gopls.
13601367
func (r *OptionResult) unexpected() {
13611368
r.Error = fmt.Errorf("unexpected gopls setting %q", r.Name)

gopls/internal/regtest/misc/configuration_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,17 @@ func TestDeprecatedSettings(t *testing.T) {
141141
"experimentalUseInvalidMetadata": true,
142142
"experimentalWatchedFileDelay": "1s",
143143
"experimentalWorkspaceModule": true,
144+
"tempModfile": true,
145+
"expandWorkspaceToModule": false,
144146
},
145147
).Run(t, "", func(t *testing.T, env *Env) {
146148
env.OnceMet(
147149
InitialWorkspaceLoad,
148150
ShownMessage("experimentalWorkspaceModule"),
149151
ShownMessage("experimentalUseInvalidMetadata"),
150152
ShownMessage("experimentalWatchedFileDelay"),
153+
ShownMessage("https://go.dev/issue/63537"), // issue to remove tempModfile
154+
ShownMessage("https://go.dev/issue/63536"), // issue to remove expandWorkspaceToModule
151155
)
152156
})
153157
}

0 commit comments

Comments
 (0)