SoFunction
Updated on 2025-03-03

How to call other programs and obtain program output in Go language

package main
import (
    "exec" // "os/exec" in go1
    "fmt"
)
func main(){
    cmd := ("ls", "-l")
    buf, err := ()
    ("%s\n%s",buf,err)
}