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:
@@ -239,7 +239,8 @@ func convertFile(filename string, buffer *bytes.Buffer) (string, []error) {
|
||||
}
|
||||
|
||||
// check for common supported but undesirable structures and clean them up
|
||||
err := bpfix.FixTree(tree, bpfix.NewFixRequest().AddAll())
|
||||
fixer := bpfix.NewFixer(tree)
|
||||
tree, err := fixer.Fix(bpfix.NewFixRequest().AddAll())
|
||||
if err != nil {
|
||||
return "", []error{err}
|
||||
}
|
||||
|
Reference in New Issue
Block a user