Golang - reading output from child process

Hello there! This will be a quick post that shows how to redirect stdout (of a child process) to a variable. Here goes the code:

package main  
import (  

func main () {  
    cmd := exec.Command("ls", "-l")
    // Create a pipe that holds stdout
    out, _ := cmd.StdoutPipe()
    // Start the child process
    // Wait for the command to exit
    defer cmd.Wait()

    // Create a new scanner 
    buff := bufio.NewScanner(out)
    var allText []string

    // Iterate over buff and append content to the slice
    for buff.Scan() {    
        allText = append(allText, buff.Text()+"\n")

Eventually, all the content of stdout will be copied to allText.

That took me a good 2 hours to figure out. I miss Python's ease already :D.

Note: bufio also provides a method called NewReader. But I couldn't figure out how I could use it in this context. Maybe another time...