mirror of
https://github.com/golang/go
synced 2024-10-14 11:53:56 +00:00
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.
This commit is contained in:
parent
ac64a3628b
commit
665929e2a2
2
src/cmd/go/internal/cache/prog.go
vendored
2
src/cmd/go/internal/cache/prog.go
vendored
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue