From c2b5fd9e9d300e1cbab96783a53547b61a5ab694 Mon Sep 17 00:00:00 2001 From: Ola Bini Date: Sat, 21 Dec 2019 23:13:41 +0000 Subject: [PATCH] Remove unneded else statements to follow Golang coding standards --- cmd/grumble/server.go | 22 ++++++++++------------ pkg/packetdata/packetdata.go | 8 ++++---- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/cmd/grumble/server.go b/cmd/grumble/server.go index ac96503..630cb85 100644 --- a/cmd/grumble/server.go +++ b/cmd/grumble/server.go @@ -492,18 +492,17 @@ func (server *Server) handleAuthenticate(client *Client, msg *Message) { if auth.Password == nil { client.RejectAuth(mumbleproto.Reject_WrongUserPW, "") return - } else { - if server.CheckSuperUserPassword(*auth.Password) { - ok := false - client.user, ok = server.UserNameMap[client.Username] - if !ok { - client.RejectAuth(mumbleproto.Reject_InvalidUsername, "") - return - } - } else { - client.RejectAuth(mumbleproto.Reject_WrongUserPW, "") + } + if server.CheckSuperUserPassword(*auth.Password) { + ok := false + client.user, ok = server.UserNameMap[client.Username] + if !ok { + client.RejectAuth(mumbleproto.Reject_InvalidUsername, "") return } + } else { + client.RejectAuth(mumbleproto.Reject_WrongUserPW, "") + return } } else { // First look up registration by name. @@ -1037,9 +1036,8 @@ func (server *Server) handleUDPPacket(udpaddr *net.UDPAddr, buf []byte) { client.Debugf("unable to decrypt incoming packet, requesting resync: %v", err) client.cryptResync() return - } else { - match = client } + match = client } if match != nil { match.udpaddr = udpaddr diff --git a/pkg/packetdata/packetdata.go b/pkg/packetdata/packetdata.go index 22ac6c2..fdf9540 100644 --- a/pkg/packetdata/packetdata.go +++ b/pkg/packetdata/packetdata.go @@ -59,9 +59,9 @@ func (pds *PacketData) next() (ret uint64) { ret = uint64(pds.Buf[pds.offset]) pds.offset++ return - } else { - pds.ok = false } + + pds.ok = false return 0 } @@ -71,9 +71,9 @@ func (pds *PacketData) Next8() (ret uint8) { ret = uint8(pds.Buf[pds.offset]) pds.offset++ return - } else { - pds.ok = false } + + pds.ok = false return 0 }