diff --git a/gopls/internal/server/command.go b/gopls/internal/server/command.go index 403eadf0d..2489a9d89 100644 --- a/gopls/internal/server/command.go +++ b/gopls/internal/server/command.go @@ -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 } diff --git a/gopls/internal/server/prompt.go b/gopls/internal/server/prompt.go index 7eb400cfb..37f591487 100644 --- a/gopls/internal/server/prompt.go +++ b/gopls/internal/server/prompt.go @@ -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) {