code: func WriteGoroutineStacks(w io.Writer) error {
  	if w == nil {
  		return fmt.Errorf("writer nil")
  	}
  	buf := make([]byte, 1<<20)
  	for i := 0; ; i++ {
  		n := runtime.Stack(buf, true)
  		if n < len(buf) {
  			buf = buf[:n]
  			break
  		}
  		if len(buf) >= 32<<20 {
  			break
  		}
  		buf = make([]byte, 2*len(buf))
  	}
  	_, err := w.Write(buf)
  	return err
  }
docs: // WriteGoroutineStacks writes out the goroutine stacks
  // of the caller. Up to 32 MB is allocated to print the
  // stack.