netConn and msgReader should return io.EOF identically instead of wrapped
- 主要语言
- Go
- 星标
- 5.5k
- 派生
- 372
- PR 合并指标
- 30 天内没有已合并 PR
描述
[*bufio.Scanner](https://pkg.go.dev/bufio#Scanner) and other consumers of `io.Reader` interface expect to receive `io.EOF` identically when reading to the end of a file/stream.
From the io package:
> // EOF is the error returned by Read when no more input is available.
> // (Read must return EOF itself, not an error wrapping EOF,
> // because callers will test for EOF using ==.)
> // Functions should return EOF only to signal a graceful end of input.
> // If the EOF occurs unexpectedly in a structured data stream,
> // the appropriate error is either [ErrUnexpectedEOF] or some other error
> // giving more detail.
> var EOF = errors.New("EOF")
We currently wrap `EOF` along with any other error when reading from `netConn` or `msgReader`. Instead, we should return `io.EOF` identically to conform with the `io.Reader` spec.
贡献指南
这个仓库没有索引到贡献指南
调研方向
定位 netConn 和 msgReader 的实现,并检查它们如何在输入结束时报告错误。将它们的行为与 io.Reader 要求 EOF 必须以相同方式返回进行比较,然后确认两个 reader 都直接返回 io.EOF,而不是包装后的错误。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- go
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 52/100