Besides what other people said, I want to clarify that whether a value
is on the stack or the heap is not a property of the language.
Different implementations of Go can and do make different choices in
this area.
For the gc compiler that most people use, you can get information
about whether a value is on the stack or the heap by using
"-gcflags=-m". For your example that prints
# command-line-arguments
foo.go:15:16: inlining call to fmt.Println
foo.go:16:16: inlining call to fmt.Println
foo.go:6:5: moved to heap: stack_array
foo.go:15:16: stack_array escapes to heap
foo.go:15:16: []interface {} literal does not escape
foo.go:16:16: slice escapes to heap
foo.go:16:16: []interface {} literal does not escape
<autogenerated>:1: .this does not escape
So at present stack_array does escape to the heap. That may change in
future releases.
You can get a bunch more info using -gcflags=-m=2.
Ian