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

View File

@@ -13,7 +13,7 @@ import (
"strings"
"github.com/AdguardTeam/AdGuardHome/internal/aghio"
"github.com/AdguardTeam/golibs/file"
"github.com/google/renameio/maybe"
)
// maxConfigFileSize is the maximum length of interfaces configuration file.
@@ -145,9 +145,9 @@ func ifaceSetStaticIP(ifaceName string) (err error) {
}
body = append(body, []byte(add)...)
err = file.SafeWrite("/etc/dhcpcd.conf", body)
err = maybe.WriteFile("/etc/dhcpcd.conf", body, 0o644)
if err != nil {
return err
return fmt.Errorf("writing conf: %w", err)
}
return nil