See also full slice expressions <https://golang.org/ref/spec#Slice_expressions>
Bug fix using full slice expressions: https://play.golang.org/p/25wqGsZZ8O On Saturday, June 18, 2016 at 2:40:54 PM UTC-4, Oliver Schmid wrote: > > Thanks for the help Jakob. Now the docs about *append()* editing in place > make more sense to me. > > For those interested someone also sent me a fix: > https://play.golang.org/p/dbYTO2h8Sw > > On Saturday, June 18, 2016 at 10:50:10 AM UTC-7, Jakob Borg wrote: >> >> 2016-06-18 19:16 GMT+02:00 Oliver Schmid <oliver...@gmail.com>: >> > Hi. I made a string only version of the powerset function on Rosetta >> Code >> > and ran into a bug where a slice input to append() [one, two, three, >> four] >> > seems to be replaced by [one, two, three, five]. What. >> >> Note that append() doesn't necessarily return a copy of the slice - if >> there is capacity in the underlying array it is modified in place and >> the length of the slice is incremented. You'll often get a slice with >> extra capacity from append(). Ponder the following: >> >> https://play.golang.org/p/1aKGTmw68t >> >> //jb >> > -- 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. For more options, visit https://groups.google.com/d/optout.