Fix linter errors

Replaced `err == io.EOF` with `errors.Is(err, io.EOF)` for better error comparison. Removed redundant `break` statements to streamline case logic and improve code readability.
This commit is contained in:
Winni Neessen 2024-09-20 15:58:51 +02:00
parent 482194b4b3
commit 157c138142
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -2097,7 +2097,7 @@ func handleTestServerConnection(connection net.Conn, featureSet string, failRese
for { for {
data, err = reader.ReadString('\n') data, err = reader.ReadString('\n')
if err != nil { if err != nil {
if err == io.EOF { if errors.Is(err, io.EOF) {
break break
} }
fmt.Println("Error reading data:", err) fmt.Println("Error reading data:", err)
@ -2158,17 +2158,14 @@ func handleTestServerConnection(connection net.Conn, featureSet string, failRese
case strings.EqualFold(data, "noop"), case strings.EqualFold(data, "noop"),
strings.EqualFold(data, "vrfy"): strings.EqualFold(data, "vrfy"):
writeOK() writeOK()
break
case strings.EqualFold(data, "rset"): case strings.EqualFold(data, "rset"):
if failReset { if failReset {
_ = writeLine("500 5.1.2 Error: reset failed") _ = writeLine("500 5.1.2 Error: reset failed")
break break
} }
writeOK() writeOK()
break
case strings.EqualFold(data, "quit"): case strings.EqualFold(data, "quit"):
_ = writeLine("221 2.0.0 Bye") _ = writeLine("221 2.0.0 Bye")
break
default: default:
_ = writeLine("500 5.5.2 Error: bad syntax") _ = writeLine("500 5.5.2 Error: bad syntax")
} }