]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/cache: use == to test for io.EOF
authorJes Cok <xigua67damn@gmail.com>
Mon, 14 Aug 2023 11:16:48 +0000 (11:16 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 14 Aug 2023 19:23:25 +0000 (19:23 +0000)
commit02b548e5c877379fa7a16c9ad653f2dadce7668f
treeb3150bf764f10c5d6ce24289316a5b8da265079f
parent52c3e8c7355f2bf8872bbfdd2a5986472d7a94ed
cmd/go/internal/cache: use == to test for io.EOF

The documentation of io.EOF: Read must return EOF itself, not an error
wrapping EOF, because callers will test for EOF using ==.

encoding/json package provides an example "ExampleDecoder" which uses
"err == io.EOF" as well, so I think it's more idiomatic to use == to test for io.EOF.

Change-Id: I8a9f06d655ca63b3ec3e7dbbdfc519a2686980e1
GitHub-Last-Rev: 665929e2a20bff231bcb5bad1384998379b41165
GitHub-Pull-Request: golang/go#62012
Reviewed-on: https://go-review.googlesource.com/c/go/+/519156
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/cmd/go/internal/cache/prog.go