coder / coder/websocket

netConn and msgReader should return io.EOF identically instead of wrapped

オープン
#504 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。