multi: replace ioutil.WriteFile

This commit is contained in:
erik
2023-06-14 11:33:44 +02:00
committed by ErikEk
parent ab83343c87
commit 789c6bac8c
13 changed files with 20 additions and 31 deletions

View File

@@ -4,7 +4,6 @@ import (
"bytes"
"encoding/hex"
"fmt"
"io/ioutil"
"net"
"os"
"strconv"
@@ -193,7 +192,7 @@ func bakeMacaroon(ctx *cli.Context) error {
// a file or write to the standard output using hex encoding.
switch {
case savePath != "":
err = ioutil.WriteFile(savePath, macBytes, 0644)
err = os.WriteFile(savePath, macBytes, 0644)
if err != nil {
return err
}
@@ -472,7 +471,7 @@ func constrainMacaroon(ctx *cli.Context) error {
}
// Now we can output the result.
err = ioutil.WriteFile(destMacFile, destMacBytes, 0644)
err = os.WriteFile(destMacFile, destMacBytes, 0644)
if err != nil {
return fmt.Errorf("error writing destination macaroon file "+
"%s: %v", destMacFile, err)

View File

@@ -6,7 +6,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"path"
"strings"
@@ -244,7 +243,8 @@ func saveProfileFile(file string, f *profileFile) error {
if err != nil {
return fmt.Errorf("could not marshal profile: %w", err)
}
return ioutil.WriteFile(file, content, 0644)
return os.WriteFile(file, content, 0644)
}
// profileFile is a struct that represents the whole content of a profile file.