зеркало из https://github.com/golang/tools.git
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 <hyangah@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Родитель
35d7f2837a
Коммит
25699c3720
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче