google/go-cmp
### [`v0.5.8`](https://togithub.com/google/go-cmp/releases/tag/v0.5.8)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.7...v0.5.8)
Reporter changes:
- ([#293](https://togithub.com/google/go-cmp/issues/293)) Fix printing of types in reporter output for interface and pointer types
- ([#294](https://togithub.com/google/go-cmp/issues/294)) Use string formatting for slice of bytes in more circumstances
Dependency changes:
- ([#292](https://togithub.com/google/go-cmp/issues/292)) Update minimum supported version to go1.13 and remove `xerrors` dependency
### [`v0.5.7`](https://togithub.com/google/go-cmp/releases/tag/v0.5.7)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.6...v0.5.7)
Reporter changes:
- ([#266](https://togithub.com/google/go-cmp/issues/266)) Fix textual printing of byte slices
- ([#275](https://togithub.com/google/go-cmp/issues/275)) Reduce minimum length for specialize string diffing
- ([#276](https://togithub.com/google/go-cmp/issues/276)) Use any alias instead of interface{}
Code cleanup changes:
- ([#281](https://togithub.com/google/go-cmp/issues/281)) Update minimum supported version to go1.11
- ([#282](https://togithub.com/google/go-cmp/issues/282)) Drop hacks to work around Go reflection bugs in Go1.9
- ([#285](https://togithub.com/google/go-cmp/issues/285)) Add //go:build lines
- ([#262](https://togithub.com/google/go-cmp/issues/262)) Fix staticcheck findings
- ([#263](https://togithub.com/google/go-cmp/issues/263)) Avoid shadowing variable
- ([#268](https://togithub.com/google/go-cmp/issues/268)) Use sha256 in test
- ([#271](https://togithub.com/google/go-cmp/issues/271)) Fix spelling mistakes
- ([#269](https://togithub.com/google/go-cmp/issues/269)) Change build status badge
### [`v0.5.6`](https://togithub.com/google/go-cmp/releases/tag/v0.5.6)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.5...v0.5.6)
Reporter changes:
- ([#258](https://togithub.com/google/go-cmp/issues/258)) Print as text if mostly text
- ([#259](https://togithub.com/google/go-cmp/issues/259)) Cleanup edit groups after coalescing
- ([#260](https://togithub.com/google/go-cmp/issues/260)) Avoid diffing by lines if inefficient
Minor documentation changes:
- ([#256](https://togithub.com/google/go-cmp/issues/256)) Fix typo in path.go
### [`v0.5.5`](https://togithub.com/google/go-cmp/releases/tag/v0.5.5)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.4...v0.5.5)
Bug fixes:
- ([#253](https://togithub.com/google/go-cmp/issues/253)) Fix reporter verbosity bug
Reporter changes:
- ([#254](https://togithub.com/google/go-cmp/issues/254)) De-virtualize interfaces for specialized diffing
Dependency changes:
- ([#251](https://togithub.com/google/go-cmp/issues/251)) Use errors.Is with ≥go1.13 in compareErrors
### [`v0.5.4`](https://togithub.com/google/go-cmp/releases/tag/v0.5.4)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.3...v0.5.4)
Bug fixes:
([#247](https://togithub.com/google/go-cmp/issues/247)) Fix non-determinism in diffing algorithm
([#248](https://togithub.com/google/go-cmp/issues/248)) Impose verbosity limit when formatting map keys
### [`v0.5.3`](https://togithub.com/google/go-cmp/releases/tag/v0.5.3)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.2...v0.5.3)
Minor documentation changes:
([#236](https://togithub.com/google/go-cmp/issues/236)) Fix license headers
([#205](https://togithub.com/google/go-cmp/issues/205)) Add an example for IgnoreFields
([#237](https://togithub.com/google/go-cmp/issues/237)) Fix Diff documentation
### [`v0.5.2`](https://togithub.com/google/go-cmp/releases/tag/v0.5.2)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.1...v0.5.2)
Minor documentation changes:
([#234](https://togithub.com/google/go-cmp/issues/234)) Suggest use of cmpopts.EquateErrors
([#231](https://togithub.com/google/go-cmp/issues/231)) Fix Diff documentation
### [`v0.5.1`](https://togithub.com/google/go-cmp/releases/tag/v0.5.1)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.0...v0.5.1)
Minor reporter changes:
- ([#221](https://togithub.com/google/go-cmp/issues/221)) Swallow panics when calling `String` or `Error` methds.
- ([#229](https://togithub.com/google/go-cmp/issues/229)) Use triple-quote formatting for multiline strings in diffs.
Minor documentation changes:
- ([#228](https://togithub.com/google/go-cmp/issues/228)) Adjust panic for `IgnoreUnexported` and `IgnoreFields` to be more specific.
### [`v0.5.0`](https://togithub.com/google/go-cmp/releases/tag/v0.5.0)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.4.1...v0.5.0)
The most notable changes in this release are improvements to the reporter output (i.e., the implementation that produces output for [`Diff`](https://pkg.go.dev/github.com/google/go-cmp/cmp?tab=doc#Diff)). The changes seek to improve the signal-to-noise ratio such that differences of interest to the user are emphasized, while information that is less relevant are de-emphasized.
The reporter largely consists of a set of heuristics to determine what would be the best way to format the difference in the common case. If the output seems sub-par, please file an issue. The reports are highly valuable in improving its output (e.g., [#195](https://togithub.com/google/go-cmp/issues/195), [#194](https://togithub.com/google/go-cmp/issues/194), [#202](https://togithub.com/google/go-cmp/issues/202), [#185](https://togithub.com/google/go-cmp/issues/185)).
**Reporter changes:**
- ([#201](https://togithub.com/google/go-cmp/issues/201)) **Do not use custom format for nil slice.** Previously, the reporter had a bug ([#157](https://togithub.com/google/go-cmp/issues/157)) where it would fail to print the difference between empty slices that were nil versus non-nil, which is now fixed by this change.
- ([#212](https://togithub.com/google/go-cmp/issues/212)) **Use custom triple-quote syntax for diffing string literals.** This adds another way that strings are displayed. Previously, the reporter used a `strings.Join({...}, "\n")` syntax to show diffs between lines within a string. While this representation is unambiguous, the need to escape every line made the output visually distracting. Now, we add a new syntax where multiple lines are represented by a literal syntax using `"""` as delimiters. When possible, this syntax is preferred if it can unambiguously represent the difference.
- ([#208](https://togithub.com/google/go-cmp/issues/208)) **Batch reporter output for simple lists of text elements.** Previously, when formatting a slice of primitives, the reporter would print each element on a new line, causing the output to be long. Now, multiple elements are batched together into a single line to keep the output more dense.
- ([#210](https://togithub.com/google/go-cmp/issues/210)) **Allow batched diffing of slices with a custom comparer.** As a performance optimization, a user may choose to pass `cmp.Comparer(bytes.Equal)` so that large byte slices are compared using an efficient implementation. Previously, this would prevent the reporter from being able to use specialized logic to show the per-element difference between these two slices if they were different, but now it is able to.
- ([#213](https://togithub.com/google/go-cmp/issues/213), [#215](https://togithub.com/google/go-cmp/issues/215)) **Limit verbosity of reporter output.** For slices, maps, and structs, the reporter now imposes a limit on the number of elements, entries, and structs that it will print. The limit is chosen based on heuristics such as the depth of the tree and also whether the node represents an equal value or not, where inequal values are given a larger verbosity budget.
- ([#216](https://togithub.com/google/go-cmp/issues/216)) **Disambiguate reporter output.** Previously, there were certain edge cases where the reporter output failed to show a difference between two values that the comparer determined to be different. Now, the reporter works harder to ensure that the output is guaranteed to be different if a semantic difference is there. For example, it may try increasing the verbosity limit, printing pointer addresses, avoid calling the `String` method, using fully qualified type names, or some combination of the above.
- ([#217](https://togithub.com/google/go-cmp/issues/217)) **Improve reporting of values with cycles.** Previously, the reporter would simply truncate the result if it ever detected a cycle. While this prevents a stack overflow trying to print a graph, it failed to properly show the topology of the graph. Now, the reporter additionally provides reference markers so that the user can visually identify where a pointer refers to in the output.
- ([`1776240`](https://togithub.com/google/go-cmp/commit/1776240f8f841dfa00cb72d811301dbb0298f983)) **Forcibly export fields for use by the reporter.** This allows the reporter to use the `String` or `Error` method (if available) to format values within unexported fields. This occurs regardless of whether any `cmp.Exporter` or `cmp.AllowUnexported` options are used or not.
- ([#210](https://togithub.com/google/go-cmp/issues/210)) **Use raw string literal syntax only for valid UTF-8.** This fixes a minor bug in the reporter to ensure that the output is always valid UTF-8.
**Feature changes:**
- ([#203](https://togithub.com/google/go-cmp/issues/203)) **Permit use of IgnoreFields with unexported fields.** The `cmpopts.IgnoreFields` option now accepts unexported field names. Unlike exported fields, unexported field must be explicitly specified as they do not respect forwarding due to struct embedding.
**Comparer changes:**
- ([#204](https://togithub.com/google/go-cmp/issues/204)) **Optimize Diff for frequent equality.** The `cmp` package is intended for use primarily within tests where the expected outcome is generally equality. Previously, even if the result is equal, `cmp.Diff` would construct an expensive diff tree only to discard the result since the values are equal. Now, optimize for the common case by first checking whether the values are equal first, and only construct a diff if they are not.
- ([#214](https://togithub.com/google/go-cmp/issues/214)) **Introduce deliberate instability to difference output.** The internal algorithm used for diffing elements of a slice is sub-optimal. It does not produce an optimal edit script (i.e., one with the fewest possible reported differences), but is guaranteed to run in O(n). To keep the future open for algorithmic improvements, introduce some degree of deliberate instability so that users do not accidentally rely on it's output being stable.
- ([#206](https://togithub.com/google/go-cmp/issues/206)) **Avoid leaking implementation details of the exporter.** In order for the current implementation to forcibly access unexported fields using `unsafe`, it requires that the parent struct be addressable. In Go, a struct field is only addressable if and only if the parent struct is addressable. To avoid leaking this internal implementation detail, we shallow copy the result to remove properties of addressability.
### [`v0.4.1`](https://togithub.com/google/go-cmp/releases/tag/v0.4.1)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.4.0...v0.4.1)
Minor reporter changes:
- ([#199](https://togithub.com/google/go-cmp/issues/199)) Format uints in decimal except bytes.
Minor documentation changes:
- ([#190](https://togithub.com/google/go-cmp/issues/190)) Update README.md to use go.dev for documentation.
- ([#189](https://togithub.com/google/go-cmp/issues/189)) Document the test-only intentions of this package.
- ([#193](https://togithub.com/google/go-cmp/issues/193)) Fix typo on example
### [`v0.4.0`](https://togithub.com/google/go-cmp/releases/tag/v0.4.0)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.3.1...v0.4.0)
Added features:
- ([#85](https://togithub.com/google/go-cmp/issues/85)) The comparison logic now has cycle detection and can now handle graphs.
- ([#176](https://togithub.com/google/go-cmp/issues/176)) The [`cmp.Exporter`](https://godoc.org/github.com/google/go-cmp/cmp#Exporter) option provides finer-grained control over exactly what types to permit unexported field access on.
- ([#158](https://togithub.com/google/go-cmp/issues/158)) [`cmpopts.EquateApproxTime`](https://godoc.org/github.com/google/go-cmp/cmp/cmpopts#EquateApproxTime) provides the ability to compare timestamps with looser precision.
- ([#178](https://togithub.com/google/go-cmp/issues/178)) [`cmpopts.EquateErrors`](https://godoc.org/github.com/google/go-cmp/cmp/cmpopts#EquateErrors) provides the ability to compare error values using the new [`errors.Is` semantics from Go 1.13](https://golang.org/doc/go1.13#error_wrapping).
Bug fixes:
- ([#169](https://togithub.com/google/go-cmp/issues/169)) Use of `unsafe.Pointer` has been fixed to comply with [stricter pointer rules for Go 1.14](https://tip.golang.org/doc/go1.14#compiler).
### [`v0.3.1`](https://togithub.com/google/go-cmp/releases/tag/v0.3.1)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.3.0...v0.3.1)
Minor reporter fixes:
- ([#142](https://togithub.com/google/go-cmp/issues/142)) Fixed reporter to invoke the `String` method when formatting map keys.
- ([#148](https://togithub.com/google/go-cmp/issues/148)) Fixed reporter to properly elide a struct field on the right side if it is a zero value.
- ([#147](https://togithub.com/google/go-cmp/issues/147)) Fixed reporter to avoid diffing by lines if any line exceeds a certain maximum length.
- ([#152](https://togithub.com/google/go-cmp/issues/152)) Fixed reporter to properly treat -0.0 as *not* being the zero value.
### [`v0.3.0`](https://togithub.com/google/go-cmp/releases/tag/v0.3.0)
[Compare Source](https://togithub.com/google/go-cmp/compare/v0.2.0...v0.3.0)
Added features:
- ([#108](https://togithub.com/google/go-cmp/issues/108)) The `_` field is always ignored when comparing a struct.
- ([#109](https://togithub.com/google/go-cmp/issues/109)) The naming rules for [`cmp.Transformer`](https://godoc.org/github.com/google/go-cmp/cmp#Transformer) is relaxed and clearly specified.
- ([#82](https://togithub.com/google/go-cmp/issues/82)) [`cmpopts.AcyclicTransformer`](https://godoc.org/github.com/google/go-cmp/cmp/cmpopts#AcyclicTransformer) makes it easier to write a transformer that avoids infinite recursion when the output type contains the input type.
- ([#126](https://togithub.com/google/go-cmp/issues/126)) [`cmpopts.IgnoreSliceElements`](https://godoc.org/github.com/google/go-cmp/cmp/cmpopts#IgnoreSliceElements) and [`cmpopts.IgnoreMapEntries`](https://godoc.org/github.com/google/go-cmp/cmp/cmpopts#IgnoreMapEntries) provide the ability to ignore specific slice elements or map entries.
- ([#123](https://togithub.com/google/go-cmp/issues/123)) [`cmp.Reporter`](https://godoc.org/github.com/google/go-cmp/cmp#Reporter) provides users the ability to add custom difference reporters.
- ([#119](https://togithub.com/google/go-cmp/issues/119)) [`cmp.PathStep.Values`](https://godoc.org/github.com/google/go-cmp/cmp#PathStep.Values) provide the current `reflect.Value` for the `x` and `y` arguments at that given path step.
Bug fixes:
- ([#87](https://togithub.com/google/go-cmp/issues/87)) Fixed proper comparing of slices where one is a sub-slice of the other.
Reporter changes:
- ([#124](https://togithub.com/google/go-cmp/issues/124)) The [`cmp.Diff`](https://pkg.go.dev/github.com/google/go-cmp/cmp?tab=doc#Diff) output has been completely re-written to provide a unified diff of the two Go objects as a literal in pseudo-Go syntax ([example](https://pkg.go.dev/github.com/google/go-cmp/cmp?tab=doc#example-Diff-Testing)).
- ([#131](https://togithub.com/google/go-cmp/issues/131)) The default reporter has built-in heuristics to detect whether a string or a byte-slice looks like binary data or human readable text, and can provide more humanly readable differences in certain use-cases. For example, a string may be detecting as containing multiple lines of text, for which it will print the difference based on the lines.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, click this checkbox.
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
v0.2.0
->v0.5.8
Release Notes
google/go-cmp
### [`v0.5.8`](https://togithub.com/google/go-cmp/releases/tag/v0.5.8) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.7...v0.5.8) Reporter changes: - ([#293](https://togithub.com/google/go-cmp/issues/293)) Fix printing of types in reporter output for interface and pointer types - ([#294](https://togithub.com/google/go-cmp/issues/294)) Use string formatting for slice of bytes in more circumstances Dependency changes: - ([#292](https://togithub.com/google/go-cmp/issues/292)) Update minimum supported version to go1.13 and remove `xerrors` dependency ### [`v0.5.7`](https://togithub.com/google/go-cmp/releases/tag/v0.5.7) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.6...v0.5.7) Reporter changes: - ([#266](https://togithub.com/google/go-cmp/issues/266)) Fix textual printing of byte slices - ([#275](https://togithub.com/google/go-cmp/issues/275)) Reduce minimum length for specialize string diffing - ([#276](https://togithub.com/google/go-cmp/issues/276)) Use any alias instead of interface{} Code cleanup changes: - ([#281](https://togithub.com/google/go-cmp/issues/281)) Update minimum supported version to go1.11 - ([#282](https://togithub.com/google/go-cmp/issues/282)) Drop hacks to work around Go reflection bugs in Go1.9 - ([#285](https://togithub.com/google/go-cmp/issues/285)) Add //go:build lines - ([#262](https://togithub.com/google/go-cmp/issues/262)) Fix staticcheck findings - ([#263](https://togithub.com/google/go-cmp/issues/263)) Avoid shadowing variable - ([#268](https://togithub.com/google/go-cmp/issues/268)) Use sha256 in test - ([#271](https://togithub.com/google/go-cmp/issues/271)) Fix spelling mistakes - ([#269](https://togithub.com/google/go-cmp/issues/269)) Change build status badge ### [`v0.5.6`](https://togithub.com/google/go-cmp/releases/tag/v0.5.6) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.5...v0.5.6) Reporter changes: - ([#258](https://togithub.com/google/go-cmp/issues/258)) Print as text if mostly text - ([#259](https://togithub.com/google/go-cmp/issues/259)) Cleanup edit groups after coalescing - ([#260](https://togithub.com/google/go-cmp/issues/260)) Avoid diffing by lines if inefficient Minor documentation changes: - ([#256](https://togithub.com/google/go-cmp/issues/256)) Fix typo in path.go ### [`v0.5.5`](https://togithub.com/google/go-cmp/releases/tag/v0.5.5) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.4...v0.5.5) Bug fixes: - ([#253](https://togithub.com/google/go-cmp/issues/253)) Fix reporter verbosity bug Reporter changes: - ([#254](https://togithub.com/google/go-cmp/issues/254)) De-virtualize interfaces for specialized diffing Dependency changes: - ([#251](https://togithub.com/google/go-cmp/issues/251)) Use errors.Is with ≥go1.13 in compareErrors ### [`v0.5.4`](https://togithub.com/google/go-cmp/releases/tag/v0.5.4) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.3...v0.5.4) Bug fixes: ([#247](https://togithub.com/google/go-cmp/issues/247)) Fix non-determinism in diffing algorithm ([#248](https://togithub.com/google/go-cmp/issues/248)) Impose verbosity limit when formatting map keys ### [`v0.5.3`](https://togithub.com/google/go-cmp/releases/tag/v0.5.3) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.2...v0.5.3) Minor documentation changes: ([#236](https://togithub.com/google/go-cmp/issues/236)) Fix license headers ([#205](https://togithub.com/google/go-cmp/issues/205)) Add an example for IgnoreFields ([#237](https://togithub.com/google/go-cmp/issues/237)) Fix Diff documentation ### [`v0.5.2`](https://togithub.com/google/go-cmp/releases/tag/v0.5.2) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.1...v0.5.2) Minor documentation changes: ([#234](https://togithub.com/google/go-cmp/issues/234)) Suggest use of cmpopts.EquateErrors ([#231](https://togithub.com/google/go-cmp/issues/231)) Fix Diff documentation ### [`v0.5.1`](https://togithub.com/google/go-cmp/releases/tag/v0.5.1) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.5.0...v0.5.1) Minor reporter changes: - ([#221](https://togithub.com/google/go-cmp/issues/221)) Swallow panics when calling `String` or `Error` methds. - ([#229](https://togithub.com/google/go-cmp/issues/229)) Use triple-quote formatting for multiline strings in diffs. Minor documentation changes: - ([#228](https://togithub.com/google/go-cmp/issues/228)) Adjust panic for `IgnoreUnexported` and `IgnoreFields` to be more specific. ### [`v0.5.0`](https://togithub.com/google/go-cmp/releases/tag/v0.5.0) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.4.1...v0.5.0) The most notable changes in this release are improvements to the reporter output (i.e., the implementation that produces output for [`Diff`](https://pkg.go.dev/github.com/google/go-cmp/cmp?tab=doc#Diff)). The changes seek to improve the signal-to-noise ratio such that differences of interest to the user are emphasized, while information that is less relevant are de-emphasized. The reporter largely consists of a set of heuristics to determine what would be the best way to format the difference in the common case. If the output seems sub-par, please file an issue. The reports are highly valuable in improving its output (e.g., [#195](https://togithub.com/google/go-cmp/issues/195), [#194](https://togithub.com/google/go-cmp/issues/194), [#202](https://togithub.com/google/go-cmp/issues/202), [#185](https://togithub.com/google/go-cmp/issues/185)). **Reporter changes:** - ([#201](https://togithub.com/google/go-cmp/issues/201)) **Do not use custom format for nil slice.** Previously, the reporter had a bug ([#157](https://togithub.com/google/go-cmp/issues/157)) where it would fail to print the difference between empty slices that were nil versus non-nil, which is now fixed by this change. - ([#212](https://togithub.com/google/go-cmp/issues/212)) **Use custom triple-quote syntax for diffing string literals.** This adds another way that strings are displayed. Previously, the reporter used a `strings.Join({...}, "\n")` syntax to show diffs between lines within a string. While this representation is unambiguous, the need to escape every line made the output visually distracting. Now, we add a new syntax where multiple lines are represented by a literal syntax using `"""` as delimiters. When possible, this syntax is preferred if it can unambiguously represent the difference. - ([#208](https://togithub.com/google/go-cmp/issues/208)) **Batch reporter output for simple lists of text elements.** Previously, when formatting a slice of primitives, the reporter would print each element on a new line, causing the output to be long. Now, multiple elements are batched together into a single line to keep the output more dense. - ([#210](https://togithub.com/google/go-cmp/issues/210)) **Allow batched diffing of slices with a custom comparer.** As a performance optimization, a user may choose to pass `cmp.Comparer(bytes.Equal)` so that large byte slices are compared using an efficient implementation. Previously, this would prevent the reporter from being able to use specialized logic to show the per-element difference between these two slices if they were different, but now it is able to. - ([#213](https://togithub.com/google/go-cmp/issues/213), [#215](https://togithub.com/google/go-cmp/issues/215)) **Limit verbosity of reporter output.** For slices, maps, and structs, the reporter now imposes a limit on the number of elements, entries, and structs that it will print. The limit is chosen based on heuristics such as the depth of the tree and also whether the node represents an equal value or not, where inequal values are given a larger verbosity budget. - ([#216](https://togithub.com/google/go-cmp/issues/216)) **Disambiguate reporter output.** Previously, there were certain edge cases where the reporter output failed to show a difference between two values that the comparer determined to be different. Now, the reporter works harder to ensure that the output is guaranteed to be different if a semantic difference is there. For example, it may try increasing the verbosity limit, printing pointer addresses, avoid calling the `String` method, using fully qualified type names, or some combination of the above. - ([#217](https://togithub.com/google/go-cmp/issues/217)) **Improve reporting of values with cycles.** Previously, the reporter would simply truncate the result if it ever detected a cycle. While this prevents a stack overflow trying to print a graph, it failed to properly show the topology of the graph. Now, the reporter additionally provides reference markers so that the user can visually identify where a pointer refers to in the output. - ([`1776240`](https://togithub.com/google/go-cmp/commit/1776240f8f841dfa00cb72d811301dbb0298f983)) **Forcibly export fields for use by the reporter.** This allows the reporter to use the `String` or `Error` method (if available) to format values within unexported fields. This occurs regardless of whether any `cmp.Exporter` or `cmp.AllowUnexported` options are used or not. - ([#210](https://togithub.com/google/go-cmp/issues/210)) **Use raw string literal syntax only for valid UTF-8.** This fixes a minor bug in the reporter to ensure that the output is always valid UTF-8. **Feature changes:** - ([#203](https://togithub.com/google/go-cmp/issues/203)) **Permit use of IgnoreFields with unexported fields.** The `cmpopts.IgnoreFields` option now accepts unexported field names. Unlike exported fields, unexported field must be explicitly specified as they do not respect forwarding due to struct embedding. **Comparer changes:** - ([#204](https://togithub.com/google/go-cmp/issues/204)) **Optimize Diff for frequent equality.** The `cmp` package is intended for use primarily within tests where the expected outcome is generally equality. Previously, even if the result is equal, `cmp.Diff` would construct an expensive diff tree only to discard the result since the values are equal. Now, optimize for the common case by first checking whether the values are equal first, and only construct a diff if they are not. - ([#214](https://togithub.com/google/go-cmp/issues/214)) **Introduce deliberate instability to difference output.** The internal algorithm used for diffing elements of a slice is sub-optimal. It does not produce an optimal edit script (i.e., one with the fewest possible reported differences), but is guaranteed to run in O(n). To keep the future open for algorithmic improvements, introduce some degree of deliberate instability so that users do not accidentally rely on it's output being stable. - ([#206](https://togithub.com/google/go-cmp/issues/206)) **Avoid leaking implementation details of the exporter.** In order for the current implementation to forcibly access unexported fields using `unsafe`, it requires that the parent struct be addressable. In Go, a struct field is only addressable if and only if the parent struct is addressable. To avoid leaking this internal implementation detail, we shallow copy the result to remove properties of addressability. ### [`v0.4.1`](https://togithub.com/google/go-cmp/releases/tag/v0.4.1) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.4.0...v0.4.1) Minor reporter changes: - ([#199](https://togithub.com/google/go-cmp/issues/199)) Format uints in decimal except bytes. Minor documentation changes: - ([#190](https://togithub.com/google/go-cmp/issues/190)) Update README.md to use go.dev for documentation. - ([#189](https://togithub.com/google/go-cmp/issues/189)) Document the test-only intentions of this package. - ([#193](https://togithub.com/google/go-cmp/issues/193)) Fix typo on example ### [`v0.4.0`](https://togithub.com/google/go-cmp/releases/tag/v0.4.0) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.3.1...v0.4.0) Added features: - ([#85](https://togithub.com/google/go-cmp/issues/85)) The comparison logic now has cycle detection and can now handle graphs. - ([#176](https://togithub.com/google/go-cmp/issues/176)) The [`cmp.Exporter`](https://godoc.org/github.com/google/go-cmp/cmp#Exporter) option provides finer-grained control over exactly what types to permit unexported field access on. - ([#158](https://togithub.com/google/go-cmp/issues/158)) [`cmpopts.EquateApproxTime`](https://godoc.org/github.com/google/go-cmp/cmp/cmpopts#EquateApproxTime) provides the ability to compare timestamps with looser precision. - ([#178](https://togithub.com/google/go-cmp/issues/178)) [`cmpopts.EquateErrors`](https://godoc.org/github.com/google/go-cmp/cmp/cmpopts#EquateErrors) provides the ability to compare error values using the new [`errors.Is` semantics from Go 1.13](https://golang.org/doc/go1.13#error_wrapping). Bug fixes: - ([#169](https://togithub.com/google/go-cmp/issues/169)) Use of `unsafe.Pointer` has been fixed to comply with [stricter pointer rules for Go 1.14](https://tip.golang.org/doc/go1.14#compiler). ### [`v0.3.1`](https://togithub.com/google/go-cmp/releases/tag/v0.3.1) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.3.0...v0.3.1) Minor reporter fixes: - ([#142](https://togithub.com/google/go-cmp/issues/142)) Fixed reporter to invoke the `String` method when formatting map keys. - ([#148](https://togithub.com/google/go-cmp/issues/148)) Fixed reporter to properly elide a struct field on the right side if it is a zero value. - ([#147](https://togithub.com/google/go-cmp/issues/147)) Fixed reporter to avoid diffing by lines if any line exceeds a certain maximum length. - ([#152](https://togithub.com/google/go-cmp/issues/152)) Fixed reporter to properly treat -0.0 as *not* being the zero value. ### [`v0.3.0`](https://togithub.com/google/go-cmp/releases/tag/v0.3.0) [Compare Source](https://togithub.com/google/go-cmp/compare/v0.2.0...v0.3.0) Added features: - ([#108](https://togithub.com/google/go-cmp/issues/108)) The `_` field is always ignored when comparing a struct. - ([#109](https://togithub.com/google/go-cmp/issues/109)) The naming rules for [`cmp.Transformer`](https://godoc.org/github.com/google/go-cmp/cmp#Transformer) is relaxed and clearly specified. - ([#82](https://togithub.com/google/go-cmp/issues/82)) [`cmpopts.AcyclicTransformer`](https://godoc.org/github.com/google/go-cmp/cmp/cmpopts#AcyclicTransformer) makes it easier to write a transformer that avoids infinite recursion when the output type contains the input type. - ([#126](https://togithub.com/google/go-cmp/issues/126)) [`cmpopts.IgnoreSliceElements`](https://godoc.org/github.com/google/go-cmp/cmp/cmpopts#IgnoreSliceElements) and [`cmpopts.IgnoreMapEntries`](https://godoc.org/github.com/google/go-cmp/cmp/cmpopts#IgnoreMapEntries) provide the ability to ignore specific slice elements or map entries. - ([#123](https://togithub.com/google/go-cmp/issues/123)) [`cmp.Reporter`](https://godoc.org/github.com/google/go-cmp/cmp#Reporter) provides users the ability to add custom difference reporters. - ([#119](https://togithub.com/google/go-cmp/issues/119)) [`cmp.PathStep.Values`](https://godoc.org/github.com/google/go-cmp/cmp#PathStep.Values) provide the current `reflect.Value` for the `x` and `y` arguments at that given path step. Bug fixes: - ([#87](https://togithub.com/google/go-cmp/issues/87)) Fixed proper comparing of slices where one is a sub-slice of the other. Reporter changes: - ([#124](https://togithub.com/google/go-cmp/issues/124)) The [`cmp.Diff`](https://pkg.go.dev/github.com/google/go-cmp/cmp?tab=doc#Diff) output has been completely re-written to provide a unified diff of the two Go objects as a literal in pseudo-Go syntax ([example](https://pkg.go.dev/github.com/google/go-cmp/cmp?tab=doc#example-Diff-Testing)). - ([#131](https://togithub.com/google/go-cmp/issues/131)) The default reporter has built-in heuristics to detect whether a string or a byte-slice looks like binary data or human readable text, and can provide more humanly readable differences in certain use-cases. For example, a string may be detecting as containing multiple lines of text, for which it will print the difference based on the lines.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.