Skip to content

unused-append-result

Detect append results that can never be observed.

Updated View as Markdown

Default severity: error

append returns the updated slice header. Discarding that result loses any new length or reallocated backing array. The check reports only function-local slices whose backing storage has not escaped or been observably aliased.

Bad

values := make([]int, 0); values = append(values, item) // values is never read again

Good

values = append(values, item)
Navigation

Type to search…

↑↓ navigate↵ selectEsc close