[go-nuts] Append function overwrites existing data in slice

2016-10-31 Thread Tamás Gulácsi
As@JimB already answewd on StackOverflow, you append a slice as an element into re.data. As a slice is just len,cap and a pointer to a backing array, if sth reuses that slice, and write to the same backing array, your "old" slice will chanfe, too! So not append is rewriting - print re.data befo

[go-nuts] Append function overwrites existing data in slice

2016-10-31 Thread Tobias Wellnitz
Hi, I wrote a small application which records data from a sound card and stores the data in an array for later processing. Whenever new data is available, portaudio executes the a callback. Within the callback I append the data to an array. The golang builtin function append adds as expected