all: replace deprecated io/ioutil with io and os (#3509)

This commit is contained in:
Oleksandr Redko
2023-09-25 21:41:59 +03:00
committed by GitHub
parent 224a2805a4
commit 899ba72505
29 changed files with 76 additions and 95 deletions

View File

@ -4,7 +4,6 @@ import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"log"
"os"
"regexp"
@ -34,7 +33,7 @@ const (
)
func spliceDocs(docpath string, docs []byte, outpath string) {
docbuf, err := ioutil.ReadFile(docpath)
docbuf, err := os.ReadFile(docpath)
if err != nil {
log.Fatalf("could not read doc file: %v", err)
}
@ -59,7 +58,7 @@ func spliceDocs(docpath string, docs []byte, outpath string) {
outbuf.Write([]byte(footer))
if outpath != "-" {
err = ioutil.WriteFile(outpath, outbuf.Bytes(), 0664)
err = os.WriteFile(outpath, outbuf.Bytes(), 0o664)
must(err, "could not write documentation file: %v", err)
} else {
os.Stdout.Write(outbuf.Bytes())