Skip to content

Instantly share code, notes, and snippets.

@scorphus
Created July 24, 2014 19:26
Show Gist options
  • Save scorphus/ae0ea470ca6fc3520fbc to your computer and use it in GitHub Desktop.
Save scorphus/ae0ea470ca6fc3520fbc to your computer and use it in GitHub Desktop.
Iteratively add arguments to a Command
cmd := exec.Command(commandPath, "foo", bar, spam)
if len(egg) > 0 {
cmd.Args = append(cmd.Args, egg)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment