I’ll tell you a story of Igor. Igor is a web developer. He’s a young man with a girlfriend and some ambitious plan in the future. Igor sit at his desk because he has some work to do. In front of him is a PC. He turns it on and sees some system updates. 30 minutes have passed, and he can see his desktop with a beautiful wallpaper. Funny cats always make his day better.
public:: true When the Go compiler cannot tell for sure that the variable under the interface won’t be used longer than the caller function lives, it will move the variable to the heap instead of the stack. When we run our code with a parameter -gcflags="-m" we’ll get (in the stdout) the heap escape analysis. The output will tell us what kind of compile optimisations are done during building a package.