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

Poor reporter output for concrete type versus interface type difference #291

Closed
dsnet opened this issue Mar 31, 2022 · 2 comments · Fixed by #293
Closed

Poor reporter output for concrete type versus interface type difference #291

dsnet opened this issue Mar 31, 2022 · 2 comments · Fixed by #293
Labels

Comments

@dsnet
Copy link
Collaborator

dsnet commented Mar 31, 2022

Consider this example:

func addr[T any](v T) *T {
	return &v
}
fmt.Println(cmp.Diff(
	addr("hello"),
	addr(any("hello")),
))

This currently prints:

  any(
- 	&⟪0xc0000102f0⟫string("hello"),
+ 	&⟪0xc000010300⟫string("hello"),
  )

which is unhelpful for determining exactly what the difference is.

@dsnet
Copy link
Collaborator Author

dsnet commented Mar 31, 2022

It should print something like:

  any(
- 	&⟪0xc0000102f0⟫string("hello"),
+ 	&⟪0xc000010300⟫any(string("hello")),
  )

or

  any(
- 	&⟪0xc0000102f0⟫string("hello"),
+ 	&⟪0xc000010300⟫any("hello"),
  )

@dsnet
Copy link
Collaborator Author

dsnet commented Mar 31, 2022

Or even:

  any(
- 	&string("hello"),
+ 	&any("hello"),
  )

printing information about the pointers is unnecessary and actually a red-herring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant