Skip to content

Glossary: Software Design Patterns in Go

slices.Clone

Also written: maps.Clone

A standard-library function that returns a new slice with the same elements (`maps.Clone` does the same for maps). It lets a repository's `All()` return a copy that callers can't damage.

Where the book teaches it

Related terms

Shallow copyRepository