From: Jes Cok Date: Mon, 14 Aug 2023 11:16:48 +0000 (+0000) Subject: cmd/go/internal/cache: use == to test for io.EOF X-Git-Tag: go1.22rc1~1307 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=02b548e5c877379fa7a16c9ad653f2dadce7668f;p=gostls13.git 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 TryBot-Result: Gopher Robot Run-TryBot: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Bryan Mills --- diff --git a/src/cmd/go/internal/cache/prog.go b/src/cmd/go/internal/cache/prog.go index 30f69b34c7..8d826f0b99 100644 --- a/src/cmd/go/internal/cache/prog.go +++ b/src/cmd/go/internal/cache/prog.go @@ -229,7 +229,7 @@ func (c *ProgCache) readLoop(readLoopDone chan<- struct{}) { if c.closing.Load() { return // quietly } - if errors.Is(err, io.EOF) { + if err == io.EOF { c.mu.Lock() inFlight := len(c.inFlight) c.mu.Unlock()