check the error that WriteFile returns

This commit is contained in:
Anton Galitsyn 2017-01-09 09:49:11 +07:00
parent e3f39f30bf
commit 8a1d43ec3f
1 changed files with 3 additions and 1 deletions

View File

@ -190,7 +190,9 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer) error {
}
f.Add(sr)
f.Add(lr)
f.WriteFile(repoFile, 0644)
if err := f.WriteFile(repoFile, 0644); err != nil {
return err
}
} else if fi.IsDir() {
return fmt.Errorf("%s must be a file, not a directory", repoFile)
}