Created
July 24, 2014 19:26
-
-
Save scorphus/ae0ea470ca6fc3520fbc to your computer and use it in GitHub Desktop.
Iteratively add arguments to a Command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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