Skip to content

Instantly share code, notes, and snippets.

@mantzas
Created May 5, 2020 12:22
Show Gist options
  • Save mantzas/cc8a139ce02dc3e93e0a5e02ec92af84 to your computer and use it in GitHub Desktop.
Save mantzas/cc8a139ce02dc3e93e0a5e02ec92af84 to your computer and use it in GitHub Desktop.
package main
import "fmt"
type Customer struct {
Name string
}
func main() {
customers := []*Customer{{Name: "Oss"}}
copyCustomer := make([]*Customer, len(customers))
copy(copyCustomer, customers)
customers[0].Name = "Sotirios"
if copyCustomer[0].Name != customers[0].Name {
fmt.Println("cloned")
return
}
fmt.Println("same")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment