github.com/gotranspile/cxgo@v0.3.7/internal/git/git.go (about) 1 package git 2 3 import ( 4 "os" 5 "os/exec" 6 ) 7 8 func Clone(repo, branch, dir string) error { 9 args := []string{ 10 "clone", 11 "--depth=1", // we are only interested in the last commit 12 } 13 if branch != "" { 14 args = append(args, "--branch", branch) 15 } 16 args = append(args, repo, dir) 17 cmd := exec.Command("git", args...) 18 cmd.Stdout = os.Stderr 19 cmd.Stderr = os.Stderr 20 return cmd.Run() 21 }