Go

Go

Made by DeepSource

Function literal can be simplified CRT-A0018

Anti-pattern
Major
Autofix

Function literals that only call a single function, without making any other changes to the value of the inner function, can be removed, as they are redundant. Instead, the inner function, that is being called inside the outer function should be called.

Bad practice

_ = func(x int, y int) int { return add(x, y) }(1, 2)

Recommended

_ = add(1, 2)