coolboi567
(Code Geass)
1
While reading large 10GB text file where each of the lines are long nested JSON.
I am reading the content using the following
scanner := bufio.NewScanner(file)
scanner.Scan()
bufio.Scanner: token too long
Need help to resolve this or, any alternative snippet.
lutzhorn
(Lutz Horn)
2
Can you show us the line that produces this error?
You could try bufio.NewReader(file) and then ReadString("/n")
Hi
Use https://golang.org/pkg/bufio/#Scanner.Buffer to set a large enough buffer for reading.
1 Like
coolboi567
(Code Geass)
5
Thanks but it required more changes in the code this way then just changing the buffer limit.

system
(system)
Closed
7
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.