From d6c5a20ae1eadf8d7b343c9cd816c491fbdb431d Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Sat, 12 Aug 2023 12:34:42 +0800 Subject: [PATCH] service/dap: use == to test io.EOF The documentation of io.EOF: Read must return EOF itself, not an error wrapping EOF, because callers will test for EOF using ==. This is a trivial change; people may think it's normal use of "errors.Is", even it's OK, it could be replaced with "errors.Is(err, io.EOF)" in idiomatic way. --- service/dap/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/dap/server.go b/service/dap/server.go index 990f9679ac..50c409f740 100644 --- a/service/dap/server.go +++ b/service/dap/server.go @@ -1051,7 +1051,7 @@ func (s *Session) onLaunchRequest(request *dap.LaunchRequest) { for { n, err := reader.Read(out[:]) if err != nil { - if errors.Is(io.EOF, err) { + if err == io.EOF { return } s.config.log.Errorf("failed read by %s - %v ", category, err)