Go

Go

Made by DeepSource

Return of nil value CRT-D0013

Bug risk
Major
Autofix

If a return statement returns a value that evaluates to nil, it is better to return nil explicitly.

Explicitly returning nil improves the program's readability and helps programmers know that they are returning nil.

Bad practice

if err == nil {
    return err
}

Recommended

if err == nil {
    return nil
}
if err != nil {
    return err
}
// ...
return nil