News for hackers. Stuff that matters.
Re:In Go, pointers (mostly) don't go with slices in practice by skybrian on Monday August 30, 2021 @04:24PM (#28360474)
There are conventions that help, but they could be made explicit:

- If you don't know where a slice came from (such as getting it passed as an argument), treat it as read-only. Any exceptions should be documented.

- If you're going to mutate a slice, make it a private member of a struct and don't give out direct access to it.

There are no comments on this comment yet.