summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-11 13:54:36 -0600
committerJeff Carr <[email protected]>2024-12-11 13:54:36 -0600
commit91602683263cf9bdde1faaad22ba46b4f006a562 (patch)
tree5214eae13727989f08d8226e668c586ebac0e283
parent0888e51c9120c564b67b7aab58afa293a6f4374d (diff)
duh. TRUNCATE on new filesv0.2.18v0.2.17v0.2.16
-rw-r--r--config.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/config.go b/config.go
index 082a2ab..6222ae0 100644
--- a/config.go
+++ b/config.go
@@ -142,7 +142,7 @@ func loadFile(filename string) ([]byte, error) {
func ConfigWriteJSON(a any, filename string) error {
fullname := filepath.Join(os.Getenv("VIRTIGO_HOME"), filename)
- cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE, 0666)
+ cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
defer cfgfile.Close()
if err != nil {
fmt.Println("open config file :", err)
@@ -159,7 +159,7 @@ func ConfigWriteJSON(a any, filename string) error {
func ConfigWriteTEXT(a any, filename string) error {
fullname := filepath.Join(os.Getenv("VIRTIGO_HOME"), filename)
- cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE, 0666)
+ cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
defer cfgfile.Close()
if err != nil {
fmt.Println("open config file :", err)
@@ -176,7 +176,7 @@ func ConfigWriteTEXT(a any, filename string) error {
func (c *Cluster) configWriteDroplets() error {
fullname := filepath.Join(os.Getenv("VIRTIGO_HOME"), "droplets.new.text")
- cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE, 0666)
+ cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
defer cfgfile.Close()
if err != nil {
fmt.Println("open config file :", err)