mirror of
https://github.com/moby/moby.git
synced 2026-08-04 23:21:00 +00:00
Merge pull request #50460 from thaJeztah/tailfile_noshadow
pkg/tailfile: rename vars that shadowed type
This commit is contained in:
@@ -32,10 +32,10 @@ func TailFile(f *os.File, n int) ([][]byte, error) {
|
||||
}
|
||||
|
||||
buf := make([][]byte, 0, nLines)
|
||||
scanner := bufio.NewScanner(r)
|
||||
s := bufio.NewScanner(r)
|
||||
|
||||
for scanner.Scan() {
|
||||
buf = append(buf, scanner.Bytes())
|
||||
for s.Scan() {
|
||||
buf = append(buf, s.Bytes())
|
||||
}
|
||||
return buf, nil
|
||||
}
|
||||
@@ -74,22 +74,22 @@ func NewTailReaderWithDelimiter(ctx context.Context, r SizeReaderAt, reqLines in
|
||||
return io.NewSectionReader(bytes.NewReader(nil), 0, 0), 0, nil
|
||||
}
|
||||
|
||||
scanner := newScanner(r, delimiter)
|
||||
for scanner.Scan(ctx) {
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, 0, scanner.Err()
|
||||
s := newScanner(r, delimiter)
|
||||
for s.Scan(ctx) {
|
||||
if err := s.Err(); err != nil {
|
||||
return nil, 0, s.Err()
|
||||
}
|
||||
|
||||
found++
|
||||
if found == 1 {
|
||||
tailEnd = scanner.End()
|
||||
tailEnd = s.End()
|
||||
}
|
||||
if found == reqLines {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
tailStart = scanner.Start(ctx)
|
||||
tailStart = s.Start(ctx)
|
||||
|
||||
if found == 0 {
|
||||
return io.NewSectionReader(bytes.NewReader(nil), 0, 0), 0, nil
|
||||
|
||||
Reference in New Issue
Block a user