Strange code fragment
Author: GoshyaCreated May 13, 2026Updated May 13, 2026
Labelscode/enhancementnot ready
What should be done?
I found two 'if' statements have identical conditions. The first 'if' statement contains function return, making the second 'if' redundant, or the code contains a logical error.
curArr, ok := cursorsV.(wirebson.AnyArray)
if !ok {
msg := fmt.Sprintf(required parameter "cursors" has type %T (expected array), cursorsV)
return nil, lazyerrors.Error(mongoerrors.NewWithArgument(mongoerrors.ErrBadValue, msg, command))
}
cursors, err := curArr.Decode() if !ok { return nil, lazyerrors.Error(err) }
A strange piece of code was found with PVS-Studio analyzer inside the msg_killcursors.go file on line 61.
Source: FerretDB/FerretDB