Shallow copying interface values in Go

12 March 2016

In go shallow copying of struct values can be considered as a feature built in the language. It is pretty obvious from language specification, that whenever you assign struct to a new variable or pass it to a function by value it gets copied.

So in simplest case you have to dereference pointer to a struct type and assign it to a local variable.

Here is an example of how to achieve this.

Read more