Created
May 5, 2020 12:22
-
-
Save mantzas/cc8a139ce02dc3e93e0a5e02ec92af84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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