// reports generates reports from inactive count files func (u *uploader) reports(todo *work) ([]string, error) { … } // latestReport returns the YYYY-MM-DD of the last report uploaded // or the empty string if there are no reports. func latestReport(uploaded map[string]bool) string { … } // notNeeded returns true if the report for date has already been created func notNeeded(date string, todo work) bool { … } func (u *uploader) deleteFiles(files []string) { … } // createReport creates local and upload report files by // combining all the count files for the expiryDate, and // returns the upload report file's path. // It may delete the count files once local and upload report // files are successfully created. func (u *uploader) createReport(start time.Time, expiryDate string, countFiles []string, lastWeek string) (string, error) { … } // exclusiveWrite attempts to create filename exclusively, and if successful, // writes content to the resulting file handle. // // It returns a boolean indicating whether the exclusive handle was acquired, // and an error indicating whether the operation succeeded. // If the file already exists, exclusiveWrite returns (false, nil). func exclusiveWrite(filename string, content []byte) (_ bool, rerr error) { … } // return an existing ProgremReport, or create anew func findProgReport(meta map[string]string, report *telemetry.Report) *telemetry.ProgramReport { … } // computeRandom returns a cryptographic random float64 in the range [0, 1], // with 52 bits of precision. func computeRandom() float64 { … }