Description
1. Unreachable code β mpping.go, bottom of main()
for {
// ... infinite loop
}
<-c // unreachable!
os.Exit(0) // unreachable!
The code after the infinite for loop can never execute. The signal handler in the goroutine already calls onStop() which exits.
2. TCP connection leak on read error β line ~213
poolConnection, err := net.Dial("tcp", ...)
// ...
fmt.Fprintf(poolConnection, request+"\n")
_, _ = bufio.NewReader(poolConnection).ReadString('\n')
// ...
poolConnection.Close()
If ReadString hangs or fails, there's no timeout on the connection. It will block forever. Use net.DialTimeout and conn.SetDeadline.
3. Deprecated ioutil usage pattern
While not directly used, the codebase follows old Go patterns.
4. strings.TrimLeft result discarded β line 63
strings.TrimLeft(urlArg, " ")
The result is never assigned back! Should be urlArg = strings.TrimLeft(urlArg, " ")
5. Division by zero possible β line 108
avgTime = poolList[poolID].TotalTime / poolList[poolID].TotalPacketsReceived
If TotalPacketsReceived is 0, this panics. The guard check exists but could be bypassed on first iteration.
File
mpping.go
Description
1. Unreachable code β
mpping.go, bottom of main()The code after the infinite
forloop can never execute. The signal handler in the goroutine already callsonStop()which exits.2. TCP connection leak on read error β line ~213
If
ReadStringhangs or fails, there's no timeout on the connection. It will block forever. Usenet.DialTimeoutandconn.SetDeadline.3. Deprecated
ioutilusage patternWhile not directly used, the codebase follows old Go patterns.
4.
strings.TrimLeftresult discarded β line 63The result is never assigned back! Should be
urlArg = strings.TrimLeft(urlArg, " ")5. Division by zero possible β line 108
If TotalPacketsReceived is 0, this panics. The guard check exists but could be bypassed on first iteration.
File
mpping.go