glog.go
func stacks(all bool, max int) []byte {
	// We don't know how big the traces are, so grow a few times if they don't fit. Start large, though.
	n := initialMaxStackBufSize
	var trace []byte
	for n <= max {
		trace = make([]byte, n)
		nbytes := runtime.Stack(trace, all)
		if nbytes < len(trace) {
			return trace[:nbytes]
		}
		n *= 2
	}
	return trace
}
func stacks(all bool, max int) []byte {
	// We don't know how big the traces are, so grow a few times if they don't fit. Start large, though.
	n := initialMaxStackBufSize
	var trace []byte
	for n <= max {
		trace = make([]byte, n)
		nbytes := runtime.Stack(trace, all)
		if nbytes < len(trace) {
			return trace[:nbytes]
		}
		n *= 2
	}
	return trace
}
// stacks is a wrapper for runtime.Stack that attempts to recover the data for all goroutines.