1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

CHORE: Remove deprecated io/ioutil (#1699)

* Remove deprecated io/ioutil

* fixup!

* fixup!
This commit is contained in:
Tom Limoncelli
2022-08-14 12:50:15 -04:00
committed by GitHub
parent 5e8bb6e461
commit cd61c2c766
25 changed files with 77 additions and 85 deletions

View File

@ -2,7 +2,6 @@ package commands
import (
"fmt"
"io/ioutil"
"os"
"github.com/ditashi/jsbeautifier-go/jsbeautifier"
@ -47,7 +46,7 @@ func (args *FmtArgs) flags() []cli.Flag {
// FmtFile reads and formats a file.
func FmtFile(args FmtArgs) error {
fileBytes, readErr := ioutil.ReadFile(args.InputFile)
fileBytes, readErr := os.ReadFile(args.InputFile)
if readErr != nil {
return readErr
}
@ -67,7 +66,7 @@ func FmtFile(args FmtArgs) error {
if args.OutputFile == "" {
fmt.Print(beautified)
} else {
if err := ioutil.WriteFile(args.OutputFile, []byte(beautified), 0744); err != nil {
if err := os.WriteFile(args.OutputFile, []byte(beautified), 0744); err != nil {
return err
}
fmt.Fprintf(os.Stderr, "File %s successfully written\n", args.OutputFile)