Pattern: Unused result of certain function call
Issue: -
This rule enforces to use return value of well-known pure functions: errors.New
, fmt.Errorf
, fmt.Sprintf
, fmt.Sprint
and sort.Reverse
.
Example of incorrect code:
func _() {
fmt.Errorf("") // result of fmt.Errorf call not used
}
Example of correct code:
func _() {
_ = fmt.Errorf("")
}