The code responsible for growing slices in append
can be found here.
As of 2014-2020 the implemented rules are:
- If appending to the slice will increase its length by more than double, the new capacity is set to the new length.
- Otherwise, double the capacity if the current length is less than 1024, or by 25% if it is larger. Repeat this step until the new capacity fits the desired length.
Presumably this isn't part of the specification so the heuristics can be changed in future if needed. You can check the most current version of this implementation on the master branch.