First, the Language foundation
Main.main function Execution procedure
Image.png
Slice the underlying array part is passed by an implicit pointer (the pointer itself is a value, only pointing to the same data), and the callee modifies the data in the underlying array by using the pointer to slice the calling parameter. But the slice itself is to maintain its corresponding data structure, for example, length and capacity. In addition, the underlying array that it points to will change when slice the underlying array. Therefore, such operations like append must return a slice reason.
There is no limit to the recursive invocation depth of functions in 3.golang, and there is no overflow error in the function call stack, because Golang dynamically adjusts the size of the function stack as needed at run time. Each goroutine just start with a small stack (4KB or 8KB), dynamically adjust the size of the stack as needed, the maximum stack can reach the GB level.
Image.png