duh. TRUNCATE on new files
This commit is contained in:
parent
0888e51c91
commit
9160268326
|
@ -142,7 +142,7 @@ func loadFile(filename string) ([]byte, error) {
|
||||||
|
|
||||||
func ConfigWriteJSON(a any, filename string) error {
|
func ConfigWriteJSON(a any, filename string) error {
|
||||||
fullname := filepath.Join(os.Getenv("VIRTIGO_HOME"), filename)
|
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()
|
defer cfgfile.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("open config file :", err)
|
fmt.Println("open config file :", err)
|
||||||
|
@ -159,7 +159,7 @@ func ConfigWriteJSON(a any, filename string) error {
|
||||||
|
|
||||||
func ConfigWriteTEXT(a any, filename string) error {
|
func ConfigWriteTEXT(a any, filename string) error {
|
||||||
fullname := filepath.Join(os.Getenv("VIRTIGO_HOME"), filename)
|
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()
|
defer cfgfile.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("open config file :", err)
|
fmt.Println("open config file :", err)
|
||||||
|
@ -176,7 +176,7 @@ func ConfigWriteTEXT(a any, filename string) error {
|
||||||
|
|
||||||
func (c *Cluster) configWriteDroplets() error {
|
func (c *Cluster) configWriteDroplets() error {
|
||||||
fullname := filepath.Join(os.Getenv("VIRTIGO_HOME"), "droplets.new.text")
|
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()
|
defer cfgfile.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("open config file :", err)
|
fmt.Println("open config file :", err)
|
||||||
|
|
Loading…
Reference in New Issue