|
|
@ -219,7 +219,7 @@ func isTestHook(h *release.Hook) bool {
|
|
|
|
// bug introduced by #8156. As part of the todo to refactor renderResources
|
|
|
|
// bug introduced by #8156. As part of the todo to refactor renderResources
|
|
|
|
// this duplicate code should be removed. It is added here so that the API
|
|
|
|
// this duplicate code should be removed. It is added here so that the API
|
|
|
|
// surface area is as minimally impacted as possible in fixing the issue.
|
|
|
|
// surface area is as minimally impacted as possible in fixing the issue.
|
|
|
|
func writeToFile(outputDir string, name string, data string, append bool) error {
|
|
|
|
func writeToFile(outputDir string, name string, data string, appendData bool) error {
|
|
|
|
outfileName := strings.Join([]string{outputDir, name}, string(filepath.Separator))
|
|
|
|
outfileName := strings.Join([]string{outputDir, name}, string(filepath.Separator))
|
|
|
|
|
|
|
|
|
|
|
|
err := ensureDirectoryForFile(outfileName)
|
|
|
|
err := ensureDirectoryForFile(outfileName)
|
|
|
@ -227,7 +227,7 @@ func writeToFile(outputDir string, name string, data string, append bool) error
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
f, err := createOrOpenFile(outfileName, append)
|
|
|
|
f, err := createOrOpenFile(outfileName, appendData)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -244,8 +244,8 @@ func writeToFile(outputDir string, name string, data string, append bool) error
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func createOrOpenFile(filename string, append bool) (*os.File, error) {
|
|
|
|
func createOrOpenFile(filename string, appendData bool) (*os.File, error) {
|
|
|
|
if append {
|
|
|
|
if appendData {
|
|
|
|
return os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0600)
|
|
|
|
return os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0600)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return os.Create(filename)
|
|
|
|
return os.Create(filename)
|
|
|
|