func (repo *gitRepo) Tags() ([]string, error) { tagcmd := ShellCmd{"git", "tag", "-l"} tagscript := CmdTemplateScript(repo.shell, repo.root, tagcmd) tagout, _, errexec := script.Output(tagscript) if errexec != nil { return nil, errexec } tags := strings.Fields(strings.Trim(string(tagout), "\n")) return tags, nil }
func (repo *gitRepo) IsClean() (bool, error) { tagcmd := ShellCmd{"git", "diff"} tagscript := CmdTemplateScript(repo.shell, repo.root, tagcmd) tagout, _, errexec := script.Output(tagscript) if errexec != nil { return false, errexec } if len(tagout) > 0 { return false, nil } return true, nil }
func GetGoVersion() (version string, revision int, err error) { if GoLinker == "" { panic(fmt.Errorf("unknown architechture %s", runtime.GOARCH)) } var p []byte p, _, err = script.Output(script.Bash.NewScript(fmt.Sprintf("%s -V", GoLinker))) if err != nil { return } pieces := strings.Fields(string(p)) if len(pieces) < 2 { err = fmt.Errorf("Didn't understand Go version %s", string(p)) } version = pieces[len(pieces)-2] revision, err = strconv.Atoi(pieces[len(pieces)-1]) return }