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

@ -7,8 +7,8 @@ import (
"path/filepath"
"runtime"
"github.com/AdguardTeam/golibs/file"
"github.com/AdguardTeam/golibs/log"
"github.com/google/renameio/maybe"
"golang.org/x/crypto/bcrypt"
yaml "gopkg.in/yaml.v2"
)
@ -99,7 +99,7 @@ func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
config.fileData = body
confFile := config.getConfigFilename()
err = file.SafeWrite(confFile, body)
err = maybe.WriteFile(confFile, body, 0o644)
if err != nil {
return fmt.Errorf("saving new config: %w", err)
}