containerd / containerd/nerdctl
follow-up to #3343: review uses of bufio.Scanner
- Dominant language
- Go
- Stars
- 10.4k
- Forks
- 826
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 44
Description
### What is the problem you're trying to solve
As discussed in https://github.com/containerd/nerdctl/issues/3343, the usage of bufio.Scanner when we do not have the control over the length of the message processed by the scanner can put the Scanner in a I/O error state failing silently and blocking the process sending a message.
@apostasie recommend that the usage of bufio.Scanner across the project is revisited.
### Describe the solution you'd like
A solution is suggested with https://github.com/containerd/nerdctl/pull/3366 but might not be a "one size fit all solution".
### Additional context
[Documentation](https://pkg.go.dev/bufio#Scanner)
The documentation state the following:
Scanning stops unrecoverably at EOF, the first I/O error, or a token too large to fit in the [Scanner.Buffer](https://pkg.go.dev/bufio#Scanner.Buffer). When a scan stops, the reader may have advanced arbitrarily far past the last token. Programs that need more control over error handling or large tokens, or must run sequential scans on a reader, should use [bufio.Reader](https://pkg.go.dev/bufio#Reader) instead.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.