Is there an effiecient way to execute system commands in golang.
Currently , the Command() needs every word to be sent as a parameter.
out, err := exec.Command("g++","test.cpp","-o","test.o").Output() [1]
is there a way where I can send it as a whole string ? like
out, err := exec.Command("g++ test.cpp -o test.o").Output() [2]
Option 1 seems difficult since you dont know the commands you will be executing at run-time. Is there a way to implement option [2] or rather a smarter way to convert option[2] to option 1 ?
Just out of curiosity why doesnt Golang implicity support [2] way of executing things ? It seems lot easier that way.
./Rahul