const promptTimeout … const gracePeriod … const samplesPerMille … const TelemetryPromptWorkTitle … const GoplsConfigDirEnvvar … const FakeTelemetryModefileEnvvar … const FakeSamplesPerMille … const TelemetryYes … const TelemetryNo … const GoTelemetryGoplsClientStartTimeEnvvar … const GoTelemetryGoplsClientTokenEnvvar … // getenv returns the effective environment variable value for the provided // key, looking up the key in the session environment before falling back on // the process environment. func (s *server) getenv(key string) string { … } // telemetryMode returns the current effective telemetry mode. // By default this is x/telemetry.Mode(), but it may be overridden for tests. func (s *server) telemetryMode() string { … } // setTelemetryMode sets the current telemetry mode. // By default this calls x/telemetry.SetMode, but it may be overridden for // tests. func (s *server) setTelemetryMode(mode string) error { … } // maybePromptForTelemetry checks for the right conditions, and then prompts // the user to ask if they want to enable Go telemetry uploading. If the user // responds 'Yes', the telemetry mode is set to "on". // // The actual conditions for prompting are defensive, erring on the side of not // prompting. // If enabled is false, this will not prompt the user in any condition, // but will send work progress reports to help testing. func (s *server) maybePromptForTelemetry(ctx context.Context, enabled bool) { … } func telemetryOnMessage(linkify bool) string { … } // acquireLockFile attempts to "acquire a lock" for writing to path. // // This is achieved by creating an exclusive lock file at <path>.lock. Lock // files expire after a period, at which point acquireLockFile will remove and // recreate the lock file. // // acquireLockFile fails if path is in a directory that doesn't exist. func acquireLockFile(path string) (func(), bool, error) { … }