Re: [go-nuts] bufio.Scanner: token too long

2020-07-12 Thread Ian Lance Taylor
On Sun, Jul 12, 2020 at 10:42 PM Gobin Sougrakpam wrote: > > I encountered this error but was able to fix it after setting the > scanner.Buffer size to a rather large number. > > bufio.Scanner: token too long ... > Now, the question is when I run this function successfully, the first token > t

[go-nuts] bufio.Scanner: token too long

2020-07-12 Thread Gobin Sougrakpam
Hi Folks, I encountered this error but was able to fix it after setting the scanner.Buffer size to a rather large number. *bufio.Scanner: token too long* Here is my fixed function: func scanFile(f *os.File) error { scanner := bufio.NewScanner(f) scanner.Buffer(make([]byte, 0, 819200), 819200)