Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 #836

Merged

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jun 18, 2020

Bumps github.com/google/go-cmp from 0.4.0 to 0.5.0.

Release notes

Sourced from github.com/google/go-cmp's releases.

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). 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, #194, #202, #185).

Reporter changes:

  • (#201) Do not use custom format for nil slice. Previously, the reporter had a bug (#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) 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) 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) 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, #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) 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) 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.
  • (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) 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) Permit use of IgnoreFields with unexported fields. The cmpopts.IgnoreFields option now accepts unexported field names. Unlike exported fields, unexported field must be explicit specified as they do not respect forwarding due to struct embedding.

Comparer changes:

  • (#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) 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) 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

Minor reporter changes:

  • (#199) Format uints in decimal except bytes.

Minor documentation changes:

  • (#190) Update README.md to use go.dev for documentation.
  • (#189) Document the test-only intentions of this package.
  • (#193) Fix typo on example
Commits
  • 77ae86f Improve reporting of values with cycles (#217)
  • c49bfce Update test case names (#218)
  • 1227731 Fix documentation on IgnoreFields (#220)
  • 44914b3 Disambiguate reporter output (#216)
  • f1780cf Limit verbosity of reporter output (#215)
  • 0d296f9 Limit number of printed differences for variable-length composites (#213)
  • 7c9a834 Introduce deliberate instability to difference output (#214)
  • 0cd6169 Use custom triple-quote syntax for diffing string literals (#212)
  • a171aa7 Use raw string literal syntax only for valid UTF-8 (#211)
  • 88849e8 Allow batched diffing of slices with a custom comparer (#210)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Jun 18, 2020
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 18, 2020

CLA Check
The committers are authorized under a signed CLA.

@lizthegrey
Copy link
Member

@dependabot rebase

@dependabot dependabot bot force-pushed the dependabot/go_modules/github.com/google/go-cmp-0.5.0 branch 3 times, most recently from 0bc81cc to 7b963e3 Compare June 22, 2020 16:55
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](google/go-cmp@v0.4.0...v0.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/go_modules/github.com/google/go-cmp-0.5.0 branch from 7b963e3 to b875ed6 Compare June 22, 2020 17:03
@evantorrie evantorrie added dependencies Pull requests that update a dependency file and removed dependencies Pull requests that update a dependency file labels Jun 22, 2020
@lizthegrey lizthegrey merged commit 59c6583 into master Jun 22, 2020
@lizthegrey lizthegrey deleted the dependabot/go_modules/github.com/google/go-cmp-0.5.0 branch June 22, 2020 17:31
@pellared pellared added this to the untracked milestone Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants