Created
July 21, 2015 02:40
-
-
Save hyper0x/d8b26118d766c984d1b5 to your computer and use it in GitHub Desktop.
This file contains 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 Person struct { | |
name string | |
} | |
type Dept struct { | |
persons [4]Person | |
} | |
func main() { | |
ch := make(chan Dept, 1) | |
persons := [4]Person{} | |
persons[0] = Person{"Robert"} | |
d1 := Dept{persons} | |
fmt.Printf("Dept1:\t\t%#v\n", d1) | |
ch <- d1 | |
d1Copy := <-ch | |
d1.persons[0].name = "Michael" | |
fmt.Printf("Dept1(2):\t%#v\n", d1) | |
fmt.Printf("Dept1 copy:\t%#v\n", d1Copy) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment