x/tools/dashboard/builder: only write VERSION file if it doesn't exist
LGTM=dsymonds R=dsymonds CC=golang-codereviews https://golang.org/cl/172610043
This commit is contained in:
parent
c2c2cf49ad
commit
9920aceb57
|
|
@ -125,8 +125,12 @@ func (env *goEnv) setup(repo *Repo, workpath, hash string, envv []string) (strin
|
||||||
if err := repo.Export(goworkpath, hash); err != nil {
|
if err := repo.Export(goworkpath, hash); err != nil {
|
||||||
return "", fmt.Errorf("error exporting repository: %s", err)
|
return "", fmt.Errorf("error exporting repository: %s", err)
|
||||||
}
|
}
|
||||||
if err := ioutil.WriteFile(filepath.Join(goworkpath, "VERSION"), []byte(hash), 0644); err != nil {
|
// Write out VERSION file if it does not already exist.
|
||||||
return "", fmt.Errorf("error writing VERSION file: %s", err)
|
vFile := filepath.Join(goworkpath, "VERSION")
|
||||||
|
if _, err := os.Stat(vFile); os.IsNotExist(err) {
|
||||||
|
if err := ioutil.WriteFile(vFile, []byte(hash), 0644); err != nil {
|
||||||
|
return "", fmt.Errorf("error writing VERSION file: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return filepath.Join(goworkpath, "src"), nil
|
return filepath.Join(goworkpath, "src"), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue