diff: add package, make testscript use it#205
Merged
mvdan merged 2 commits intorogpeppe:masterfrom Mar 22, 2023
Merged
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.
Collaborator
Author
|
CC @thepudds |
Collaborator
Author
|
Roger agreed in #157 (comment), and again in voice, so I'm merging :) |
Collaborator
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(see commit messages - please do not squash)
Fixes #157.