From 340ad458d3abe8479aa5b2c5b62c01e40447a652 Mon Sep 17 00:00:00 2001 From: Ernest Galbrun Date: Wed, 29 Jul 2020 14:44:33 +0200 Subject: [PATCH] Update compare.go Fix the doc about the cmp.Diff method. It was mentioning the plus or minus sign being printed if, respectively, the field was added to x or removed to y, but both things are equivalent. The sign change if a field is removed or added from y alone. --- cmp/compare.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmp/compare.go b/cmp/compare.go index 580ae20..6656186 100644 --- a/cmp/compare.go +++ b/cmp/compare.go @@ -95,12 +95,12 @@ func Equal(x, y interface{}, opts ...Option) bool { return s.result.Equal() } -// Diff returns a human-readable report of the differences between two values. -// It returns an empty string if and only if Equal returns true for the same -// input values and options. +// Diff returns a human-readable report of the differences between two values: +// y - x. It returns an empty string if and only if Equal returns true for the +// same input values and options. // // The output is displayed as a literal in pseudo-Go syntax. -// At the start of each line, a "-" prefix indicates an element removed from x, +// At the start of each line, a "-" prefix indicates an element removed from y, // a "+" prefix to indicates an element added to y, and the lack of a prefix // indicates an element common to both x and y. If possible, the output // uses fmt.Stringer.String or error.Error methods to produce more humanly