From 74e7af3a74c424f342a04a1378c69a86940b2080 Mon Sep 17 00:00:00 2001 From: Xumeiquer Date: Wed, 29 Mar 2017 23:49:59 +0200 Subject: [PATCH] Using 1024*1024 buffer when converting JSON to Yara --- main.funcs.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.funcs.go b/main.funcs.go index 246052a..627b82d 100644 --- a/main.funcs.go +++ b/main.funcs.go @@ -19,6 +19,7 @@ const ( INLINE = `(?m)\s*//.*[\n\r][\n\r]?` BLANKS = `(?m)\s+$` QUOTES = `"` + MAXBUFF = 1024 * 1024 // If needed Go will take it form RAM. ) func processFile(fileName string) []*yago.Parser { @@ -115,8 +116,10 @@ func processInputFile(inputFile string, validJSON bool) []*yago.Parser { checkErr(err) defer file.Close() + var buff []byte + scanner := bufio.NewScanner(file) - // scanner.Split(splitBy) + scanner.Buffer(buff, MAXBUFF) var rules *yago.Parser for scanner.Scan() {