-
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
improve diff for []byte values #272
Comments
The output doesn't have to be valid Go (it already isn't), we could probably simplify it: [][]byte{
- "hello",
"foo",
+ "foo",
"barbaz",
- "blahdieblah",
+ "added",
+ "here",
+ "hrmph",
} |
It would be quite nice if that were valid Go. |
FWIW I just had an idea that the output might be nicer if we used a Transform step to translate []byte to string
|
dsnet
added a commit
that referenced
this issue
Apr 24, 2022
If a slice of bytes is mostly text, format them as text instead of as []byte literal with hexadecimal digits. Avoid always printing the type. This is technically invalid Go code, but is unnecessary in many cases since the type is inferred from the parent concrete type. Fixes #272
dsnet
added a commit
that referenced
this issue
Apr 24, 2022
If a slice of bytes is mostly text, format them as text instead of as []byte literal with hexadecimal digits. Avoid always printing the type. This is technically invalid Go code, but is unnecessary in many cases since the type is inferred from the parent concrete type. Fixes #272
dsnet
added a commit
that referenced
this issue
Apr 24, 2022
If a slice of bytes is mostly text, format them as text instead of as []byte literal with hexadecimal digits. Avoid always printing the type. This is technically invalid Go code, but is unnecessary in many cases since the type is inferred from the parent concrete type. Fixes #272
dsnet
added a commit
that referenced
this issue
Apr 24, 2022
If a slice of bytes is mostly text, format them as text instead of as []byte literal with hexadecimal digits. Avoid always printing the type. This is technically invalid Go code, but is unnecessary in many cases since the type is inferred from the parent concrete type. Fixes #272
dsnet
added a commit
that referenced
this issue
Apr 25, 2022
If a slice of bytes is mostly text, format them as text instead of as []byte literal with hexadecimal digits. Avoid always printing the type. This is technically invalid Go code, but is unnecessary in many cases since the type is inferred from the parent concrete type. Fixes #272
dsnet
added a commit
that referenced
this issue
Apr 25, 2022
If a slice of bytes is mostly text, format them as text instead of as []byte literal with hexadecimal digits. Avoid always printing the type. This is technically invalid Go code, but is unnecessary in many cases since the type is inferred from the parent concrete type. Fixes #272
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[]byte
is commonly used to encode strings, so it's hard to read the diff when it's phrased in terms of hex bytes rather than strings.For example, compare the two diff outputs in this example:
I think it would be better to see something like this instead:
The text was updated successfully, but these errors were encountered: