This is the second post in a series on common Go footguns. This post demonstrates the performance impacts of appending a known number of elements to a slice without doing any pre-allocation. This is one of the most common and easily fixed performance issues I see in pull requests on a regular basis.
Some projects make rather heavy use of gomock for testing, and I’ve noticed the command that I had been using to run all tests and generate coverage included the mocks in coverage and brought the numbers down.