github.com/client9/goreleaser@v0.17.4-0.20170511023544-27e4b028926d/pipeline/git/exec.go (about)

     1  package git
     2  
     3  import (
     4  	"errors"
     5  	"os/exec"
     6  	"strings"
     7  )
     8  
     9  func git(args ...string) (output string, err error) {
    10  	var cmd = exec.Command("git", args...)
    11  	bts, err := cmd.CombinedOutput()
    12  	if err != nil {
    13  		return "", errors.New(string(bts))
    14  	}
    15  	return string(bts), err
    16  }
    17  
    18  func cleanGit(args ...string) (output string, err error) {
    19  	output, err = git(args...)
    20  	return strings.Replace(strings.Split(output, "\n")[0], "'", "", -1), err
    21  }