27 lines
466 B
Go
27 lines
466 B
Go
|
// Git wrapper
|
||
|
//
|
||
|
// Facilitates the usage of `git` commands when dealing with
|
||
|
// data living in repositories.
|
||
|
|
||
|
package git
|
||
|
|
||
|
import (
|
||
|
"os/exec"
|
||
|
)
|
||
|
|
||
|
type GitClient interface {
|
||
|
Clone(path string, destination string) (string, error)
|
||
|
}
|
||
|
|
||
|
type Git struct{}
|
||
|
|
||
|
func (g Git) Clone(path string, destination string) (string, error) {
|
||
|
cloneCmd := exec.Command("git", "clone", path, destination)
|
||
|
|
||
|
if err := cloneCmd.Run(); err != nil {
|
||
|
return "", err
|
||
|
}
|
||
|
|
||
|
return path, nil
|
||
|
}
|