Linked Questions

Popular Questions

Can I use make(chan someStruct) in go?

Asked by At

for example:

type name struct {
    name string
    age int
}

func main() {
      c := make(chan name)

      c <- name{"sfsaf", 1}
      a, b := <- c

      close(c)
}

The result:

fatal error: all goroutines are asleep - deadlock!

I want to pass values through channel. What should I do?

Related Questions