Appease/placate/mollify the linter

- Unnecessarily handle the error in the `defer`
- Do a better comparison of the address-in-use error
This commit is contained in:
Brian Cunnie
2024-06-15 18:49:18 -07:00
parent 8a08e49034
commit 093fc5dadf

View File

@@ -165,7 +165,9 @@ func readFromTCP(tcpListener *net.TCPListener, x *xip.Xip, quiet bool) {
addr, port, err := net.SplitHostPort(remoteAddrPort)
go func() {
defer tcpConn.Close()
defer func(tcpConn *net.TCPConn) {
_ = tcpConn.Close()
}(tcpConn)
response, logMessage, err := x.QueryResponse(query, net.ParseIP(addr))
if err != nil {
log.Println(err.Error())
@@ -256,7 +258,7 @@ func isErrorAddressAlreadyInUse(err error) bool {
if !errors.As(eOsSyscall, &errErrno) {
return false
}
if errErrno == syscall.EADDRINUSE {
if errors.Is(errErrno, syscall.EADDRINUSE) {
return true
}
const WSAEADDRINUSE = 10048