Last active
June 22, 2022 11:31
-
-
Save jryannel/4a9a82929d0de89d88be6954821bb347 to your computer and use it in GitHub Desktop.
Executes git command
This file contains hidden or 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
// ExecGit executes a git command. | |
func ExecGit(args ...string) error { | |
log.Debugf("exec git %s", args) | |
_, err := exec.LookPath("git") | |
if err != nil { | |
log.Warnf("git not found") | |
return err | |
} | |
err = exec.Command("git", args...).Run() | |
if err != nil { | |
log.Warnf("git %s failed", args) | |
return err | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment