-
Notifications
You must be signed in to change notification settings - Fork 77
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
diff: add package, make testscript use it #205
Conversation
From Go tip as of March 21st 2023, at commit 5f1a0320b92a60ee1283522135e00bff540ea115. The only change is to replace the internal/txtar dependency with our own txtar package. It seems like upstream has its own tiny copy of x/tools/txtar, presumably so that even low level packages can use txtar in tests. Fixes rogpeppe#157.
The main reason to prefer a copy of Go's internal/diff over pkg/diff is that internal/diff is much more efficient in both time and memory usage. In particular, pkg/diff required quadratic space in memory, which could easily cause "out of memory" errors in Go tests per pkg/diff#26. Beyond making the `cmp` command better able to handle large files, this also moves us back to having zero external dependencies, which is always a nice to have. The long_diff test still appears to work well; the output is changed since the new package produces a shorter, but still entirely correct, diff. It also seems like the new package includes a leading "diff" line to show the two filenames. That seems like a harmless change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - but would also ask @rogpeppe to confirm the change in package "API" surface.
CC @thepudds |
Roger agreed in #157 (comment), and again in voice, so I'm merging :) |
Hi @mvdan , looks great, and thanks! (Sorry, this was still on my to do list, but not my "Burning Must Do Now" list 😅 ). Would it make sense to remove or modify as well (currently still there on Lines 144 to 152 in 50a1440
|
Oh my, how did I miss that? Happy to approve and merge a PR if you send one, otherwise I'll send one in a bit and you can approve. |
(see commit messages - please do not squash)
Fixes #157.