Skip to content

Commit

Permalink
internal/server: make MaybePromptForTelemetry no-op
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
hyangah authored and gopherbot committed Nov 8, 2024
1 parent 35d7f28 commit 25699c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gopls/internal/server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,11 @@ func (h *commandHandler) Packages(ctx context.Context, args command.PackagesArgs
}

func (h *commandHandler) MaybePromptForTelemetry(ctx context.Context) error {
go h.s.maybePromptForTelemetry(ctx, true)
// if the server's TelemetryPrompt is true, it's likely the server already
// handled prompting for it. Don't try to prompt again.
if !h.s.options.TelemetryPrompt {
go h.s.maybePromptForTelemetry(ctx, true)
}
return nil
}

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

0 comments on commit 25699c3

Please sign in to comment.