Skip to content

Files

Latest commit

 

History

History
28 lines (18 loc) · 593 Bytes

unused.md

File metadata and controls

28 lines (18 loc) · 593 Bytes

Pattern: Unused result of certain function call

Issue: -

Description

This rule enforces to use return value of well-known pure functions - errors.New, fmt.Errorf, fmt.Sprintf, fmt.Sprint, sort.Reverse - as well as Error and String methods.

Example of incorrect code:

func _() {
	fmt.Errorf("") // result of fmt.Errorf call not used
}

Example of correct code:

func _() {
	_ = fmt.Errorf("")
}

Further Reading