Skip to content

Commit

Permalink
Fix Diff documentation (#231)
Browse files Browse the repository at this point in the history
Fix the documentation on Diff. It was mentioning the plus or minus sign being printed if the field was added to y or removed from y, but both are the same. Fix it so that it properly mentions the use of a minus sign for elements removed from x.
  • Loading branch information
ernest-galbrun committed Jul 29, 2020
1 parent 9680bfa commit 036ffc7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmp/compare.go
Expand Up @@ -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
Expand Down

0 comments on commit 036ffc7

Please sign in to comment.