Member-only story

Golang

ScanLines limit bytes in Golang

Donald Le
Nov 10, 2020

When working with bufio.ScanLines for retrieving text from file per say, if the string in line exceed default Scan (64K), then we cannot get the full line.

To overcome this problem, simply set maxCapacity to the scan.

In this example we set the maxCapacity to 512MB.

Hope this helps!!

PEACE!!

--

--

Donald Le
Donald Le

Written by Donald Le

A passionate automation engineer who strongly believes in “A man can do anything he wants if he puts in the work”.

No responses yet