1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

improve linting

This commit is contained in:
Casey Lee 2019-01-15 17:41:02 -08:00
parent c9c2a3d905
commit d2c440bf4f
7 changed files with 136 additions and 61 deletions

View file

@ -39,7 +39,7 @@ func FindGitRevision(file string) (shortSha string, sha string, err error) {
if err != nil {
return "", "", err
}
return string(string(refBuf)[:7]), string(refBuf), nil
return string(refBuf[:7]), string(refBuf), nil
}
// FindGitBranch get the current git branch
@ -72,9 +72,15 @@ func findGitHead(file string) (string, error) {
}()
headBuffer := new(bytes.Buffer)
headBuffer.ReadFrom(bufio.NewReader(headFile))
_, err = headBuffer.ReadFrom(bufio.NewReader(headFile))
if err != nil {
log.Error(err)
}
head := make(map[string]string)
yaml.Unmarshal(headBuffer.Bytes(), head)
err = yaml.Unmarshal(headBuffer.Bytes(), head)
if err != nil {
log.Error(err)
}
log.Debugf("HEAD points to '%s'", head["ref"])
@ -204,9 +210,12 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) Executor {
return err
}
w.Pull(&git.PullOptions{
err = w.Pull(&git.PullOptions{
ReferenceName: refName,
})
if err != nil {
input.Logger.Errorf("Unable to pull %s: %v", refName, err)
}
input.Logger.Debugf("Cloned %s to %s", input.URL.String(), input.Dir)
err = w.Checkout(&git.CheckoutOptions{