aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOleksandr Redko <[email protected]>2023-05-23 17:55:26 +0300
committerBjørn Erik Pedersen <[email protected]>2023-06-01 17:52:21 +0200
commit4c46f9400b91a205361210e8eb0c1718784ec8f2 (patch)
tree4f560a8d1c4f549b413acf4660812a4477da37a2
parent8c7a4e995bbc8e9781b3765c2c6e3c3ae806c200 (diff)
downloadhugo-4c46f9400b91a205361210e8eb0c1718784ec8f2.tar.gz
hugo-4c46f9400b91a205361210e8eb0c1718784ec8f2.zip
all: Replace deprecated ioutil with io and os
-rw-r--r--commands/server.go3
-rw-r--r--main_test.go4
-rw-r--r--tpl/internal/templatefuncsRegistry.go3
3 files changed, 4 insertions, 6 deletions
diff --git a/commands/server.go b/commands/server.go
index c878cac2f..048b13ba3 100644
--- a/commands/server.go
+++ b/commands/server.go
@@ -20,7 +20,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"net"
"net/http"
"net/url"
@@ -848,7 +847,7 @@ func (c *serverCommand) serve() error {
if err != nil {
return err
}
- err = ioutil.WriteFile(readyFile, b, 0777)
+ err = os.WriteFile(readyFile, b, 0777)
if err != nil {
return err
}
diff --git a/main_test.go b/main_test.go
index 5629db3fe..aae8a0a9e 100644
--- a/main_test.go
+++ b/main_test.go
@@ -17,8 +17,8 @@ import (
"bytes"
"encoding/json"
"fmt"
+ "io"
"io/fs"
- "io/ioutil"
"log"
"net/http"
"os"
@@ -203,7 +203,7 @@ var commonTestScriptsParam = testscript.Params{
}
defer resp.Body.Close()
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to read response body: %v", err)
}
diff --git a/tpl/internal/templatefuncsRegistry.go b/tpl/internal/templatefuncsRegistry.go
index eea14372b..c1b01f5a5 100644
--- a/tpl/internal/templatefuncsRegistry.go
+++ b/tpl/internal/templatefuncsRegistry.go
@@ -23,7 +23,6 @@ import (
"go/doc"
"go/parser"
"go/token"
- "io/ioutil"
"log"
"os"
"path/filepath"
@@ -276,7 +275,7 @@ func getGetTplPackagesGoDoc() map[string]map[string]methodGoDocInfo {
basePath = filepath.Join(pwd, "tpl")
}
- files, err := ioutil.ReadDir(basePath)
+ files, err := os.ReadDir(basePath)
if err != nil {
log.Fatal(err)
}