Skip to content

Commit 3f87ee4

Browse files
fuziontechclaude
andcommitted
Fix errcheck lint: discard SetReadDeadline and Close errors
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 83a7c13 commit 3f87ee4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

server/conn.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (c *clientConn) startDisconnectMonitor(ctx context.Context) (stop func()) {
247247
go func() {
248248
defer close(stopped)
249249
for {
250-
c.conn.SetReadDeadline(time.Now().Add(500 * time.Millisecond))
250+
_ = c.conn.SetReadDeadline(time.Now().Add(500 * time.Millisecond))
251251
_, err := c.reader.Peek(1)
252252
if err != nil {
253253
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
@@ -281,11 +281,11 @@ func (c *clientConn) startDisconnectMonitor(ctx context.Context) (stop func()) {
281281
return func() {
282282
close(done)
283283
// Interrupt any in-progress Peek by setting a past deadline.
284-
c.conn.SetReadDeadline(time.Now())
284+
_ = c.conn.SetReadDeadline(time.Now())
285285
<-stopped
286286
// Clear the deadline so the message loop's next read uses
287287
// the idle timeout (or no deadline).
288-
c.conn.SetReadDeadline(time.Time{})
288+
_ = c.conn.SetReadDeadline(time.Time{})
289289
}
290290
}
291291

server/flight_executor_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ func TestFlightExecutor_MergedContextCallerCancel(t *testing.T) {
180180
func TestDisconnectMonitor_DetectsClose(t *testing.T) {
181181
// Create a connected pair of net.Conn (using net.Pipe).
182182
server, client := net.Pipe()
183-
defer server.Close()
184-
defer client.Close()
183+
defer func() { _ = server.Close() }()
184+
defer func() { _ = client.Close() }()
185185

186186
connCtx, connCancel := context.WithCancel(context.Background())
187187
defer connCancel()
@@ -200,7 +200,7 @@ func TestDisconnectMonitor_DetectsClose(t *testing.T) {
200200
defer stop()
201201

202202
// Close the client side to simulate client disconnect.
203-
client.Close()
203+
_ = client.Close()
204204

205205
// The monitor should detect the disconnect and cancel connCtx.
206206
select {
@@ -215,8 +215,8 @@ func TestDisconnectMonitor_StopBeforeDisconnect(t *testing.T) {
215215
// Verify that stop() returns promptly and the context is NOT cancelled
216216
// when the connection is still alive.
217217
server, client := net.Pipe()
218-
defer server.Close()
219-
defer client.Close()
218+
defer func() { _ = server.Close() }()
219+
defer func() { _ = client.Close() }()
220220

221221
connCtx, connCancel := context.WithCancel(context.Background())
222222
defer connCancel()
@@ -260,8 +260,8 @@ func TestDisconnectMonitor_BufferedDataNotLost(t *testing.T) {
260260
// Verify that data arriving during monitoring stays in the bufio.Reader
261261
// buffer and can be read after the monitor stops.
262262
server, client := net.Pipe()
263-
defer server.Close()
264-
defer client.Close()
263+
defer func() { _ = server.Close() }()
264+
defer func() { _ = client.Close() }()
265265

266266
connCtx, connCancel := context.WithCancel(context.Background())
267267
defer connCancel()

0 commit comments

Comments
 (0)