diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2021-02-22 20:37:25 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2021-02-22 21:02:12 +0100 |
| commit | fcc6d71be2c3ce7d9305c04fc2e87af554571bac (patch) | |
| tree | b01dbb3d1e2988e28ea158d2d543d603ec0b9569 /vendor/github.com/golangci/revgrep | |
| parent | 8f23c528ad5a943b9ffec5dcaf332fd0f614006e (diff) | |
go.mod: update golangci-lint to v1.37
Diffstat (limited to 'vendor/github.com/golangci/revgrep')
| -rw-r--r-- | vendor/github.com/golangci/revgrep/go.mod | 3 | ||||
| -rw-r--r-- | vendor/github.com/golangci/revgrep/go.sum | 0 | ||||
| -rw-r--r-- | vendor/github.com/golangci/revgrep/revgrep.go | 22 |
3 files changed, 20 insertions, 5 deletions
diff --git a/vendor/github.com/golangci/revgrep/go.mod b/vendor/github.com/golangci/revgrep/go.mod new file mode 100644 index 000000000..8bdbb1951 --- /dev/null +++ b/vendor/github.com/golangci/revgrep/go.mod @@ -0,0 +1,3 @@ +module github.com/golangci/revgrep + +go 1.13 diff --git a/vendor/github.com/golangci/revgrep/go.sum b/vendor/github.com/golangci/revgrep/go.sum new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/vendor/github.com/golangci/revgrep/go.sum diff --git a/vendor/github.com/golangci/revgrep/revgrep.go b/vendor/github.com/golangci/revgrep/revgrep.go index 3650d646a..d0940d300 100644 --- a/vendor/github.com/golangci/revgrep/revgrep.go +++ b/vendor/github.com/golangci/revgrep/revgrep.go @@ -279,9 +279,21 @@ func (c Checker) linesChanged() map[string][]pos { return changes } - scanner := bufio.NewScanner(c.Patch) - for scanner.Scan() { - line := scanner.Text() // TODO scanner.Bytes() + scanner := bufio.NewReader(c.Patch) + var scanErr error + for { + lineB, isPrefix, err := scanner.ReadLine() + if isPrefix { + // If a single line overflowed the buffer, don't bother processing it as + // it's likey part of a file and not relevant to the patch. + continue + } + if err != nil { + scanErr = err + break + } + line := strings.TrimRight(string(lineB), "\n") + c.debugf(line) s.lineNo++ s.hunkPos++ @@ -313,8 +325,8 @@ func (c Checker) linesChanged() map[string][]pos { } } - if err := scanner.Err(); err != nil { - fmt.Fprintln(os.Stderr, "reading standard input:", err) + if scanErr != nil && scanErr != io.EOF { + fmt.Fprintln(os.Stderr, "reading standard input:", scanErr) } // record the last state changes[s.file] = s.changes |
