Make bpfix not modify the input tree

Make a new object called Fixer to hold the state of the tree, and
make a copy of the input tree so the original doesn't get modified.

Test: bpfix_test.go
Change-Id: I1dc6fd99158c8b0e1db029df99e6cf72699a5e63
This commit is contained in:
Colin Cross
2018-04-11 16:10:18 -07:00
parent 02b4da53a7
commit adee968a4b
4 changed files with 68 additions and 24 deletions

View File

@@ -75,7 +75,8 @@ func processFile(filename string, in io.Reader, out io.Writer, fixRequest bpfix.
}
// compute and apply any requested fixes
err = bpfix.FixTree(file, fixRequest)
fixer := bpfix.NewFixer(file)
file, err = fixer.Fix(fixRequest)
if err != nil {
return err
}