Programming Code Center(PCC)
[GO]

(PCC)::[How-to-perform-Execing-Processes-operations-in-go-language]::[go]

File Name : execing-processes.go

package main

import (
    "os"
    "os/exec"
    "syscall"
)

func main() {

    binary, lookErr := exec.LookPath("ls")
    if lookErr != nil {
        panic(lookErr)
    }

    args := []string{"ls", "-a", "-l", "-h"}

    env := os.Environ()

    execErr := syscall.Exec(binary, args, env)
    if execErr != nil {
        panic(execErr)
    }
}

Output :

execing-processes.jpg