-
Notifications
You must be signed in to change notification settings - Fork 209
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
Optionally disable truncating string output in diffs #279
Comments
We've historically avoided any knobs to configure the verbosity of the output and instead relied upon heuristics to determine how much output is helpful to emit. This is especially relevant for recursive data structures where the "full" output may be infinite. To better tune the heuristics, do you have a reproduction that I can look at? |
Sure, here's a reproduction: https://play.golang.org/p/KwJoZWmrtiC The error message there is actually copy/pasted from our codebase. Please let me know if I can provide any more information. If we need to implement a certain interface, or something, that's something we can do. Sadly, the type in question is an interface, so I can't promise things like "it will always be a struct" or "it will always have a property named this". I'm wondering if defining a |
I'm not sure I understand the original problem. The reproduction prints:
Even if the string is truncated, it's clear what's different at a higher level. That is, one |
My issue is that the helpful information is the bit that's truncated. I know I've got one more Diagnostics are our version of errors; knowing I've got an error is helpful, but knowing what the error is is more helpful. |
I am also curious how can this be tweaked a bit, as I have nested struct with long URLs inside it, and URLs get truncated |
I also have long structures which are getting truncated. For my particular case, it's not too relevant for the portions which are |
@PatrickCronin Please share code example if you do get around truncation with custom Reporter, thanks. |
Closing as duplicate of #264. Let's only keep one issue open about adjusting verbosity. |
Hello,
We're using cmp to check our test output:
This works great usually, and has been incredibly helpful.
However, we have certain error output that can contain long strings. To make matters worse, the long string sometimes has the error information we need at the end, not at the beginning.
So our test will fail with an unexpected error (not actually an
error
interface implementation, it's a long story. It's a struct of strings) and will helpfully tell us there's one error more than it expected. Unhelpfully, though, the information about what the error is is truncated by cmp. So to find out what error actually occurred, we need to go in and add a logging statement to log what the error was and print the whole thing.This works, but it would be much more convenient if cmp would just print the whole string for us.
Is there a method we can implement or an option we can pass that just says "no, show the whole string"? Is there a way to achieve that outcome?
The text was updated successfully, but these errors were encountered: