go-graphite / carbonapi

Implementation of graphite API (graphite-web) in golang
Other
308 stars 140 forks source link

Update functions that were modifying original input #711

Closed carrieedwards closed 2 years ago

carrieedwards commented 2 years ago

Several functions were still modifying the original series input, instead of making a copy before processing the data. This can lead to no-copy-on write bugs. This PR updates the remaining functions that were using r := *a, instead using r := a.CopyLinkTags().

msaf1980 commented 2 years ago

r := *a results[i] = &r

No modify origin is this case. Color is a string Main reson for use CopyTags and avoid dereference a - copy to heap allocated again in original code - better performance. CopyTags do no-deep (linked) copy in one step.