Fix usage of bytes.NewBuffer in bpfix
According to the documentation: "NewBuffer creates and initializes a new Buffer using buf as its initial contents. The new Buffer takes ownership of buf, and the caller should not use buf after this call." Test: Run bpfix twice, only wrote the first time. Change-Id: I52f88bfd9247240436b46f396c9196157774615b
This commit is contained in:
parent
4339853a20
commit
d6989f2e52
|
@ -65,7 +65,7 @@ func processFile(filename string, in io.Reader, out io.Writer, fixRequest bpfix.
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r := bytes.NewBuffer(src)
|
||||
r := bytes.NewBuffer(append([]byte(nil), src...))
|
||||
file, errs := parser.Parse(filename, r, parser.NewScope(nil))
|
||||
if len(errs) > 0 {
|
||||
for _, err := range errs {
|
||||
|
|
Loading…
Reference in New Issue