Skip to content

Glossary: Software Design Patterns in Go

Shallow copy

Also written: shallow

A copy that duplicates a struct's own fields but still shares any slice or map inside it. Copy those by hand with `slices.Clone` or `maps.Clone`, or a change to the copy alters the original's items.

Where the book teaches it

Related terms

Prototypeslices.Clone