mirror of
https://github.com/tomnomnom/gron
synced 2024-10-18 08:42:21 +00:00
Use larger buffer when ungron
This commit is contained in:
parent
404b80f960
commit
a2fa995cab
3
main.go
3
main.go
|
@ -312,6 +312,9 @@ func ungron(r io.Reader, w io.Writer, opts int) (int, error) {
|
|||
scanner := bufio.NewScanner(r)
|
||||
var maker statementmaker
|
||||
|
||||
// Allow larger internal buffer of the scanner (min: 64KiB ~ max: 1MiB)
|
||||
scanner.Buffer(make([]byte, 64*1024), 1024*1024)
|
||||
|
||||
if opts&optJSON > 0 {
|
||||
maker = statementFromJSONSpec
|
||||
} else {
|
||||
|
|
|
@ -137,6 +137,7 @@ func TestUngron(t *testing.T) {
|
|||
{"testdata/three.gron", "testdata/three.json"},
|
||||
{"testdata/grep-separators.gron", "testdata/grep-separators.json"},
|
||||
{"testdata/github.gron", "testdata/github.json"},
|
||||
{"testdata/large-line.gron", "testdata/large-line.json"},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
|
|
2
testdata/large-line.gron
vendored
Normal file
2
testdata/large-line.gron
vendored
Normal file
File diff suppressed because one or more lines are too long
1
testdata/large-line.json
vendored
Normal file
1
testdata/large-line.json
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue