Skip to content

fix(lib): remove deprecated net.Error.Temporary() from the proxy accept loop - #565

Open
0xrlawrence wants to merge 1 commit into
canopy-network:mainfrom
0xrlawrence:fix/deprecated-net-error-temporary
Open

fix(lib): remove deprecated net.Error.Temporary() from the proxy accept loop#565
0xrlawrence wants to merge 1 commit into
canopy-network:mainfrom
0xrlawrence:fix/deprecated-net-error-temporary

Conversation

@0xrlawrence

Copy link
Copy Markdown

Description

net.Error.Temporary() has been deprecated since Go 1.18 because its semantics are not well defined. staticcheck reports it as SA1019.

In this accept loop the call was also dead code. Both branches did exactly the same thing — log a warning, sleep 50ms, continue — differing only in the wording of the log line:

if ne, ok := err.(net.Error); ok && ne.Temporary() {
    p.log.Warnf("validator tcp proxy temporary accept error on port %d: %v", port, err)
    time.Sleep(50 * time.Millisecond)
    continue
}
p.log.Warnf("validator tcp proxy accept error on port %d: %v", port, err)
time.Sleep(50 * time.Millisecond)
continue

Deliberate shutdown is already handled by the ctx.Done() check immediately above.

Changes Made

  • Collapsed to the single retry path and dropped the deprecated call.

Testing

  • go build ./...
  • go test ./lib/ passes
  • staticcheck no longer reports SA1019 at lib/peer.go:542

No behaviour change beyond one log message no longer being labelled "temporary".

🤖 Generated with Claude Code

…pt loop

net.Error.Temporary() has been deprecated since Go 1.18 because its
semantics are not well defined, and staticcheck reports it as SA1019.

In this accept loop the call was also dead: both the 'temporary' branch and
the fall-through did exactly the same thing — log a warning, sleep 50ms,
and continue — differing only in the wording of the log line. Deliberate
shutdown is already handled by the ctx.Done() check immediately above.

Collapsed to the single retry path. No behaviour change beyond one log
message no longer being labelled 'temporary'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant