mirror of
https://github.com/cunnie/sslip.io.git
synced 2025-10-06 08:06:53 +08:00
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:
6
main.go
6
main.go
@@ -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
|
||||
|
Reference in New Issue
Block a user