### Install MakeZero Source: https://github.com/ashanbrown/makezero/blob/master/README.md Install the makezero tool using the Go install command. Ensure you specify the version tag for the latest release. ```Go go install github.com/ashanbrown/makezero/v2@latest ``` -------------------------------- ### Basic Slice Initialization with Append Source: https://github.com/ashanbrown/makezero/blob/master/README.md This example demonstrates a common scenario where a slice is initialized with a non-zero length and then appended to, which can lead to unintended empty elements. Makezero flags this pattern. ```Go func copyNumbers(nums []int) []int { values := make([]int, len(nums)) // satisfy prealloc for _, n := range nums { values = append(values, n) } return values } ``` -------------------------------- ### Recommended Zero-Length Initialization Source: https://github.com/ashanbrown/makezero/blob/master/README.md This snippet shows the recommended way to initialize a slice when you intend to use `append`. It specifies an initial length of 0 and capacity based on the input slice length. ```Go values := make([]int, 0, len(nums)) ``` -------------------------------- ### Slice Initialization with Index Assignment Source: https://github.com/ashanbrown/makezero/blob/master/README.md This Go code initializes a slice with a non-zero length and then assigns elements using an index. This pattern is discouraged by makezero when the slice is not intended to have pre-filled empty elements. ```Go func copyNumbers(nums []int) []int { values := make([]int, len(nums)) for i, n := range nums { values[i] = n } return values } ``` -------------------------------- ### Ignoring MakeZero Issues Source: https://github.com/ashanbrown/makezero/blob/master/README.md Use the `// nozero` directive as a comment on a specific line to ignore any issues reported by makezero for that line. ```Go // nozero ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.