Migrate io/ioutil uses to new APIs.
ioutil has been deprecated since Go 1.16. The functions were moved to
some combination of io and os. See https://pkg.go.dev/io/ioutil.
(File-related functions went to os. Generic things went to io. Names
were kept the same except TempDir and TempFile are os.MkdirTemp and
os.CreateTemp, respectively.)
Change-Id: I031306f69e70424841df08f64fa9d90f31780928
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/55186
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
diff --git a/util/doc.go b/util/doc.go
index 651998e..0460890 100644
--- a/util/doc.go
+++ b/util/doc.go
@@ -14,7 +14,6 @@
"flag"
"fmt"
"html/template"
- "io/ioutil"
"os"
"path/filepath"
"regexp"
@@ -746,11 +745,11 @@
}
func copyFile(outPath string, inFilePath string) error {
- bytes, err := ioutil.ReadFile(inFilePath)
+ bytes, err := os.ReadFile(inFilePath)
if err != nil {
return err
}
- return ioutil.WriteFile(filepath.Join(outPath, filepath.Base(inFilePath)), bytes, 0666)
+ return os.WriteFile(filepath.Join(outPath, filepath.Base(inFilePath)), bytes, 0666)
}
func main() {
@@ -772,7 +771,7 @@
os.Exit(1)
}
- configBytes, err := ioutil.ReadFile(*configFlag)
+ configBytes, err := os.ReadFile(*configFlag)
if err != nil {
fmt.Printf("Failed to open config file: %s\n", err)
os.Exit(1)