On Tue, 15 Oct 2019 03:16:35 -0700 (PDT) Stuart Davies <sdd.dav...@gmail.com> wrote:
Uh, the important citation got deleted somehow: [...] https://golang.org/ref/spec#Appending_and_copying_slices "If the capacity of s is not large enough to fit the additional values, append allocates a new, sufficiently large underlying array that fits both the existing slice elements and the additional values. Otherwise, append re-uses the underlying array. " Correct use of append is to reassign the target array: target = append(target, toappend) then append will take care of resizing/copying for you. Hope this helps, -- Wojciech S. Czarnecki << ^oo^ >> OHIR-RIPE -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/20191015134349.6148fb74%40zuzia.