mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 23:54:33 +01:00
golangci-lint's errcheck rule requires explicit handling of error return values from Close, Write, and Logout calls. Use blank identifier assignment for cleanup paths where errors are intentionally discarded.
18 lines
388 B
Go
18 lines
388 B
Go
package scenario
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"erupe-ce/cmd/protbot/protocol"
|
|
)
|
|
|
|
// Logout sends MSG_SYS_LOGOUT and closes the channel connection.
|
|
func Logout(ch *protocol.ChannelConn) error {
|
|
fmt.Println("[logout] Sending MSG_SYS_LOGOUT...")
|
|
if err := ch.SendPacket(protocol.BuildLogoutPacket()); err != nil {
|
|
_ = ch.Close()
|
|
return fmt.Errorf("logout send: %w", err)
|
|
}
|
|
return ch.Close()
|
|
}
|