modernice / goes

goes is an event-sourcing framework for Go.
https://goes.modernice.dev
Apache License 2.0
134 stars 12 forks source link

Prevent caller to modify underlying array #156

Closed groggy7 closed 1 year ago

groggy7 commented 1 year ago

copiedEvents := make([]event.Event, len(tx.insertedEvents)) copy(copiedEvents, tx.insertedEvents)

return copiedEvents

with this code i copied the slice and returned it.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **goes** | ⬜️ Ignored ([Inspect](https://vercel.com/modernice/goes/8Sbqa1Q55Jo4ihoDsWXK8bATB9oR)) | [Visit Preview](https://goes-git-fork-groggy7-slice-copy-problem-modernice.vercel.app) | | Sep 24, 2023 0:38am |
bounoable commented 1 year ago

thanks! 👍🏼