Skip to content

Commit 25699c3

Browse files
hyangahgopherbot
authored andcommitted
internal/server: make MaybePromptForTelemetry no-op
For the transition of vscode go extension users who explicitly trigger prompting using the command, make the command no-op if the telemetry prompt setting is already true. For golang/go#67821 Change-Id: I648c5a8e4449eeb15fb28c71879c967975363a79 Reviewed-on: https://go-review.googlesource.com/c/tools/+/589836 Auto-Submit: Hyang-Ah Hana Kim <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
1 parent 35d7f28 commit 25699c3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

gopls/internal/server/command.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ func (h *commandHandler) Packages(ctx context.Context, args command.PackagesArgs
256256
}
257257

258258
func (h *commandHandler) MaybePromptForTelemetry(ctx context.Context) error {
259-
go h.s.maybePromptForTelemetry(ctx, true)
259+
// if the server's TelemetryPrompt is true, it's likely the server already
260+
// handled prompting for it. Don't try to prompt again.
261+
if !h.s.options.TelemetryPrompt {
262+
go h.s.maybePromptForTelemetry(ctx, true)
263+
}
260264
return nil
261265
}
262266

gopls/internal/server/prompt.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ func (s *server) maybePromptForTelemetry(ctx context.Context, enabled bool) {
162162
// v0.17 ~: must have all four fields.
163163
} else {
164164
state, attempts, creationTime, token = pUnknown, 0, 0, 0
165+
// TODO(hyangah): why do we want to present this as an error to user?
165166
errorf("malformed prompt result %q", string(content))
166167
}
167168
} else if !os.IsNotExist(err) {

0 commit comments

Comments
 (0)