style: satisfy golangci-lint on the round-6 changes
All checks were successful
check / check (push) Successful in 7m26s
All checks were successful
check / check (push) Successful in 7m26s
nolintlint: gosec was not firing on the deferred Close. nonamedreturns + varnamelen in collapseUserModeOps.
This commit is contained in:
@@ -161,7 +161,7 @@ func (c *Conn) Disconnect(reason string) {
|
|||||||
func (c *Conn) notifyKilledAndClose(
|
func (c *Conn) notifyKilledAndClose(
|
||||||
nick, host, reason string,
|
nick, host, reason string,
|
||||||
) {
|
) {
|
||||||
defer c.conn.Close() //nolint:errcheck,gosec
|
defer c.conn.Close() //nolint:errcheck
|
||||||
|
|
||||||
c.sendWithin(
|
c.sendWithin(
|
||||||
killWriteWindow,
|
killWriteWindow,
|
||||||
|
|||||||
@@ -1070,20 +1070,22 @@ func isKnownUserModeChar(modeChar rune) bool {
|
|||||||
// defence-in-depth only.
|
// defence-in-depth only.
|
||||||
func collapseUserModeOps(
|
func collapseUserModeOps(
|
||||||
ops []userModeOp,
|
ops []userModeOp,
|
||||||
) (wallops, oper *bool, err error) {
|
) (*bool, *bool, error) {
|
||||||
unknownFlag := &IRCError{
|
unknownFlag := &IRCError{
|
||||||
Code: irc.ErrUmodeUnknownFlag,
|
Code: irc.ErrUmodeUnknownFlag,
|
||||||
Params: nil,
|
Params: nil,
|
||||||
Message: "Unknown MODE flag",
|
Message: "Unknown MODE flag",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, op := range ops {
|
var wallops, oper *bool
|
||||||
switch op.char {
|
|
||||||
|
for _, modeOp := range ops {
|
||||||
|
switch modeOp.char {
|
||||||
case 'w':
|
case 'w':
|
||||||
val := op.adding
|
val := modeOp.adding
|
||||||
wallops = &val
|
wallops = &val
|
||||||
case 'o':
|
case 'o':
|
||||||
if op.adding {
|
if modeOp.adding {
|
||||||
return nil, nil, unknownFlag
|
return nil, nil, unknownFlag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user