I have a function func more(... t). I\'m wondering if it\'s possible to use a slice to populate a list of arguments ... .
I\'m trying to s
func Command
func Command(name string, arg ...string) *CmdCommand returns the Cmd struct to execute the named program with the given arguments.
So you have to extract the command which is found at sliceA[0] and then pass all the arguments with a variadic but removing the command sliceA[1:]....
import "os/exec"
import "strings"
func main(){
plainCommand := "echo hello world"
sliceA := strings.Fields(plainCommand)
cmd := exec.Command(sliceA[0], sliceA[1:]...)
}