Replace ioutil.WriteFile with File.Write

This would eliminate the need to comment the need to Chmod.
However, we need to Close the file manually now since ioutil.WriteFile
does it internally.
pull/4106/head
Amir Saeid 7 years ago
parent 5bad262d98
commit efecbf14cc

@ -111,8 +111,10 @@ func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *proven
} }
tmpfilename := tmpfile.Name() tmpfilename := tmpfile.Name()
// 0644 here is ineffective since TempFile creates files with 0600 permission. We'll chmod it later. if _, err := tmpfile.Write(data.Bytes()); err != nil {
if err := ioutil.WriteFile(tmpfilename, data.Bytes(), 0644); err != nil { return tmpfilename, nil, err
}
if err := tmpfile.Close(); err != nil {
return tmpfilename, nil, err return tmpfilename, nil, err
} }

Loading…
Cancel
Save