aboutsummaryrefslogtreecommitdiffstats
path: root/bpfix
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2018-05-07 16:22:22 -0700
committerDan Willemsen <dwillemsen@google.com>2018-05-07 16:22:22 -0700
commitd6989f2e5225145a26af0844c11b310dfbe76483 (patch)
treef55f95e128ba34e316a06f7fc6359e1f2493b39d /bpfix
parent4339853a20bc300968d0389f4f9307ec415d540d (diff)
downloadbuild_soong-d6989f2e5225145a26af0844c11b310dfbe76483.tar.gz
build_soong-d6989f2e5225145a26af0844c11b310dfbe76483.tar.bz2
build_soong-d6989f2e5225145a26af0844c11b310dfbe76483.zip
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
Diffstat (limited to 'bpfix')
-rw-r--r--bpfix/cmd/bpfix.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/bpfix/cmd/bpfix.go b/bpfix/cmd/bpfix.go
index 2fde3836..ccdae165 100644
--- a/bpfix/cmd/bpfix.go
+++ b/bpfix/cmd/bpfix.go
@@ -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 {