I just did a simple test with a 2M line file and it worked fine, so I
suspect it's a bug in your code. But if not, please provide a complete
working executable example, with data, to help identify the problem.

-rob


On Thu, Oct 12, 2023 at 7:39 PM 'Mark' via golang-nuts <
golang-nuts@googlegroups.com> wrote:

> I'm reading Debian *Package files, some of which are over 1M lines long.
> I used bufio.Scanner and found that it won't read past 1M lines (I'm using
> Go 1.21.1 linux/amd64).
> Is this a limitation of bufio.Scanner? If so then it ought to be in the
> docs.
> Or is it a bug?
> Or maybe I made a mistake (although using bufio.Scanner seems easy)?
> ```
> scanner := bufio.NewScanner(file)
>         lino := 1
> for scanner.Scan() {
> line := scanner.Text()
>                 lino++
>                 ... // etc
>         }
> ```
> Anyway, I've switched to using bufio.Reader and that works great.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/69f2fa03-c650-4c02-9470-51894dc56d1an%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/69f2fa03-c650-4c02-9470-51894dc56d1an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOXNBZSNV4-uJ5FtXOvSiOADjCWX15g5TVgjCOrRLjiHqeTqrQ%40mail.gmail.com.

Reply via email to