Go

Go

Made by DeepSource

deferred function literal can be simplified GO-C4005

Style
Major

It is recommended to remove the wrapping function literal if it has a single function call. This makes the code succinct.

Bad practice

func foo() {
    defer func() {
        bar()
    }()
}

Recommended

func foo() {
    defer bar()
}