Skip to content

Use bufio.Reader to handle large git histories #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 8, 2021

Conversation

schallert
Copy link

Processing large git repositories with revgrep may result in failed
parsing due to long lines. For example:

$ golint ./... |& revgrep abcd1234
reading standard input: bufio.Scanner: token too long

From the Go documentation for Scanner:

Programs that need more control over error handling or large tokens, or
must run sequential scans on a reader, should use bufio.Reader instead.

This updates revgrep's git reader to use bufio.Reader to avoid this
issue. For example:

$ golint ./... |& revgrep abcd1234
mycode.go:8:2: a blank import should be only in a main or test package,
or have a comment justifying it

I don't have a reproducible test case as this happened in non-public code,
but can try to put one together.

The tests are failing for me on TestChangesWriter for this PR, but the same
occur encountered on master.

Processing large git repositories with `revgrep` may result in failed
parsing due to long lines. For example:

```
$ golint ./... |& revgrep abcd1234
reading standard input: bufio.Scanner: token too long
```

From the Go documentation for Scanner:
```
Programs that need more control over error handling or large tokens, or
must run sequential scans on a reader, should use bufio.Reader instead.
```

This updates `revgrep`'s git reader to use `bufio.Reader` to avoid this
issue. For example:
```
$ golint ./... |& revgrep abcd1234
mycode.go:8:2: a blank import should be only in a main or test package,
or have a comment justifying it
```
@ernado ernado merged commit cd28932 into golangci:master Feb 8, 2021
@ldez ldez mentioned this pull request Feb 8, 2021
@schallert schallert deleted the schallert/large_input branch February 13, 2021 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants