Reports slice declarations with empty literal initializers used instead of nil.

An empty slice can be represented by nil or an empty slice literal. The first approach is preferred as it does not lead to memory allocation. For more information about empty slices, see Declaring Empty Slices at golang.org.

Example:

s := []string{}

To change the declaration, use the Replace with nil slice declaration (changes semantics) quick-fix. After the quick-fix is applied:

var s []string