http://play.golang.org/p/r92-KtQEGl我正在尝试执行此代码。它将引发死锁错误。我想念什么?package mainimport "tour/tree"import "fmt"// Walk walks the tree t sending all values// from the tree to the channel ch.func Walk(t *tree.Tree, ch chan int){ var temp chan int ch <- t.Value if t.Left!=nil{go Walk(t.Left,temp)} if t.Right!=nil{go Walk(t.Right,temp)} for i := range temp{ ch <- i } close(ch)}// Same determines whether the trees// t1 and t2 contain the same values.func Same(t1, t2 *tree.Tree) bool
2 回答
- 2 回答
- 0 关注
- 147 浏览
添加回答
举报
0/150
提交
取消