fix: create the file if it does not exist
This commit is contained in:
1 parent
947b2d4db6
commit
e0a70411dd
1 file changed
+1
-1
@@ -172,7 +172,7 @@ func SetPermissions(path string, fileMode os.FileMode) error {
|
|||||||
|
|
||||||
// WriteSliceToFile writes a slice of strings to a file
|
// WriteSliceToFile writes a slice of strings to a file
|
||||||
func WriteSliceToFile(filename string, lines []string) error {
|
func WriteSliceToFile(filename string, lines []string) error {
|
||||||
file, err := os.OpenFile(filename, os.O_RDWR|os.O_TRUNC, 0600)
|
file, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user