netConn and msgReader should return io.EOF identically instead of wrapped
- Ngôn ngữ chính
- Go
- Star
- 5.5k
- Fork
- 372
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
[*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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Xác định các triển khai của netConn và msgReader rồi kiểm tra cách chúng báo cáo lỗi khi kết thúc đầu vào. So sánh hành vi của chúng với yêu cầu của io.Reader rằng EOF phải được trả về một cách nhất quán, sau đó xác minh rằng cả hai reader đều trả về trực tiếp io.EOF thay vì một lỗi được bọc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- go
- Lĩnh vực
- networking
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100