Pull request: all: use renameio instead of golibs/file

Merge in DNS/adguard-home from use-renameio to master

Squashed commit of the following:

commit 807cda37b0e9e49539c1a8ce7912b74bd3c05b08
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Apr 6 19:54:21 2021 +0300

    all: use renameio instead of golibs/file
This commit is contained in:
Ainar Garipov 2021-04-06 20:48:36 +03:00
parent 65553a29e9
commit 00a61fdea0
6 changed files with 22 additions and 14 deletions
internal/home

View file

@ -14,8 +14,8 @@ import (
"github.com/AdguardTeam/AdGuardHome/internal/querylog"
"github.com/AdguardTeam/AdGuardHome/internal/stats"
"github.com/AdguardTeam/AdGuardHome/internal/version"
"github.com/AdguardTeam/golibs/file"
"github.com/AdguardTeam/golibs/log"
"github.com/google/renameio/maybe"
yaml "gopkg.in/yaml.v2"
)
@ -314,11 +314,14 @@ func (c *configuration) write() error {
config.Clients = nil
if err != nil {
log.Error("Couldn't generate YAML file: %s", err)
return err
}
err = file.SafeWrite(configFile, yamlText)
err = maybe.WriteFile(configFile, yamlText, 0o644)
if err != nil {
log.Error("Couldn't save YAML config: %s", err)
return err
}