func equateAlways(_, _ interface{ … } // EquateEmpty returns a [cmp.Comparer] option that determines all maps and slices // with a length of zero to be equal, regardless of whether they are nil. // // EquateEmpty can be used in conjunction with [SortSlices] and [SortMaps]. func EquateEmpty() cmp.Option { … } func isEmpty(x, y interface{ … } // EquateApprox returns a [cmp.Comparer] option that determines float32 or float64 // values to be equal if they are within a relative fraction or absolute margin. // This option is not used when either x or y is NaN or infinite. // // The fraction determines that the difference of two values must be within the // smaller fraction of the two values, while the margin determines that the two // values must be within some absolute margin. // To express only a fraction or only a margin, use 0 for the other parameter. // The fraction and margin must be non-negative. // // The mathematical expression used is equivalent to: // // |x-y| ≤ max(fraction*min(|x|, |y|), margin) // // EquateApprox can be used in conjunction with [EquateNaNs]. func EquateApprox(fraction, margin float64) cmp.Option { … } type approximator … func areRealF64s(x, y float64) bool { … } func areRealF32s(x, y float32) bool { … } func (a approximator) compareF64(x, y float64) bool { … } func (a approximator) compareF32(x, y float32) bool { … } // EquateNaNs returns a [cmp.Comparer] option that determines float32 and float64 // NaN values to be equal. // // EquateNaNs can be used in conjunction with [EquateApprox]. func EquateNaNs() cmp.Option { … } func areNaNsF64s(x, y float64) bool { … } func areNaNsF32s(x, y float32) bool { … } // EquateApproxTime returns a [cmp.Comparer] option that determines two non-zero // [time.Time] values to be equal if they are within some margin of one another. // If both times have a monotonic clock reading, then the monotonic time // difference will be used. The margin must be non-negative. func EquateApproxTime(margin time.Duration) cmp.Option { … } func areNonZeroTimes(x, y time.Time) bool { … } type timeApproximator … func (a timeApproximator) compare(x, y time.Time) bool { … } var AnyError … type anyError … func (anyError) Error() string { … } func (anyError) Is(err error) bool { … } // EquateErrors returns a [cmp.Comparer] option that determines errors to be equal // if [errors.Is] reports them to match. The [AnyError] error can be used to // match any non-nil error. func EquateErrors() cmp.Option { … } // areConcreteErrors reports whether x and y are types that implement error. // The input types are deliberately of the interface{} type rather than the // error type so that we can handle situations where the current type is an // interface{}, but the underlying concrete types both happen to implement // the error interface. func areConcreteErrors(x, y interface{ … } func compareErrors(x, y interface{ … } // EquateComparable returns a [cmp.Option] that determines equality // of comparable types by directly comparing them using the == operator in Go. // The types to compare are specified by passing a value of that type. // This option should only be used on types that are documented as being // safe for direct == comparison. For example, [net/netip.Addr] is documented // as being semantically safe to use with ==, while [time.Time] is documented // to discourage the use of == on time values. func EquateComparable(typs ...interface{ … } type typesFilter … func (tf typesFilter) filter(p cmp.Path) bool { … } func equateAny(x, y interface{ … }