cmp/report_text.go
func (s diffStats) String() string {
	var ss []string
	var sum int
	labels := [...]string{"ignored", "identical", "removed", "inserted", "modified"}
	counts := [...]int{s.NumIgnored, s.NumIdentical, s.NumRemoved, s.NumInserted, s.NumModified}
	for i, n := range counts {
		if n > 0 {
			ss = append(ss, fmt.Sprintf("%d %v", n, labels[i]))
		}
		sum += n
	}

	// Pluralize the name (adjusting for some obscure English grammar rules).
	name := s.Name
	if sum > 1 {
		name = name + "s"
		if strings.HasSuffix(name, "ys") {
			name = name[:len(name)-2] + "ies" // e.g., "entrys" => "entries"
		}
	}

	// Format the list according to English grammar (with Oxford comma).
	switch n := len(ss); n {
	case 0:
		return ""
	case 1, 2:
		return strings.Join(ss, " and ") + " " + name
	default:
		return strings.Join(ss[:n-1], ", ") + ", and " + ss[n-1] + " " + name
	}
}
func (s diffStats) String() string {
	var ss []string
	var sum int
	labels := [...]string{"ignored", "identical", "removed", "inserted", "modified"}
	counts := [...]int{s.NumIgnored, s.NumIdentical, s.NumRemoved, s.NumInserted, s.NumModified}
	for i, n := range counts {
		if n > 0 {
			ss = append(ss, fmt.Sprintf("%d %v", n, labels[i]))
		}
		sum += n
	}

	// Pluralize the name (adjusting for some obscure English grammar rules).
	name := s.Name
	if sum > 1 {
		name = name + "s"
		if strings.HasSuffix(name, "ys") {
			name = name[:len(name)-2] + "ies" // e.g., "entrys" => "entries"
		}
	}

	// Format the list according to English grammar (with Oxford comma).
	switch n := len(ss); n {
	case 0:
		return ""
	case 1, 2:
		return strings.Join(ss, " and ") + " " + name
	default:
		return strings.Join(ss[:n-1], ", ") + ", and " + ss[n-1] + " " + name
	}
}
// String prints a humanly-readable summary of coalesced records.
//
// Example:
//	diffStats{Name: "Field", NumIgnored: 5}.String() => "5 ignored fields"