I am trying to execute a command using go.
executableCommand := strings.Split("git commit -m 'hello world'", " ")
executeCommand(executableCommand[0], executableCommand[1:]...)
cmd := exec.Command(command, args...)
But here is what I get
error: pathspec 'world"' did not match any file(s) known to git.
exit status 1
This is due to the fact that it -mreceives only 'hello, and not 'hello world', since the command line is split using " ".
Any idea to make it work?
source
share