sanposhiho / gomockhandler

Mr. gomockhandler is the clever and more agile manager of golang/mock (uber/mock) 👔
MIT License
105 stars 8 forks source link

use bufio.Reader instead of bufio.Scanner #79

Closed 0tarof closed 2 years ago

0tarof commented 2 years ago

gomockhandler check is failed when scan the large single line file. Because ~os~ of hard limit of bufio.Scanner.

So use bufio.Reader to scan first line of file.

P.S. There is another approach like filtering target files using extension, etc...

sanposhiho commented 2 years ago

Thanks for opening PR. I'll review it later.

Because os hard limit of bufio.Scanner.

I don't know about that. 😓

0tarof commented 2 years ago

bufio.Scanner has default token size defained at bufio.MaxScanToken. Ref: https://cs.opensource.google/go/go/+/refs/tags/go1.17.5:src/bufio/scan.go;l=81;bpv=1;bpt=1

if line length is greater than maxTokenSize, then Scanner.Scan function is failed with bufio.ErrTooLong.

In my case, gomockhandler scans large json configuration file on directory tree, then the command failed with that error.