fork download
  1. package main
  2.  
  3. import "fmt"
  4. import "runtime/debug"
  5.  
  6. func main(){
  7. ch := make(chan int)
  8. go method1(ch)
  9. fmt.Println(<-ch)
  10. }
  11.  
  12. func method1(c chan int) {
  13. method2(c)
  14. }
  15.  
  16. func method2(c chan int) {
  17. method3(c)
  18. }
  19.  
  20. func method3(c chan int) {
  21. method4(c)
  22. }
  23.  
  24. func method4(c chan int) {
  25. method5(c)
  26. }
  27.  
  28. func method5(c chan int) {
  29. debug.PrintStack()
  30. c <- 5
  31. }
Success #stdin #stdout #stderr 0.01s 5436KB
stdin
Standard input is empty
stdout
5
stderr
goroutine 5 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/opt/go/src/runtime/debug/stack.go:24 +0x9d
runtime/debug.PrintStack()
	/opt/go/src/runtime/debug/stack.go:16 +0x22
main.method5(...)
	/home/PCGF4N/prog.go:29
main.method4(...)
	/home/PCGF4N/prog.go:25
main.method3(...)
	/home/PCGF4N/prog.go:21
main.method2(...)
	/home/PCGF4N/prog.go:17
main.method1(0xc000050060)
	/home/PCGF4N/prog.go:13 +0x26
created by main.main
	/home/PCGF4N/prog.go:8 +0x5c