8000 all: Replace deprecated ioutil with io and os · gohugoio/hugo@4c46f94 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c46f94

Browse files
alexandearbep
authored andcommitted
all: Replace deprecated ioutil with io and os
1 parent 8c7a4e9 commit 4c46f94

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

commands/server.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"errors"
2121
"fmt"
2222
"io"
23-
"io/ioutil"
2423
"net"
2524
"net/http"
2625
"net/url"
@@ -848,7 +847,7 @@ func (c *serverCommand) serve() error {
848847
if err != nil {
849848
return err
850849
}
851-
err = ioutil.WriteFile(readyFile, b, 0777)
850+
err = os.WriteFile(readyFile, b, 0777)
852851
if err != nil {
853852
return err
854853
}

main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"bytes"
1818
"encoding/json"
1919
"fmt"
20+
"io"
2021
"io/fs"
21-
"io/ioutil"
2222
"log"
2323
"net/http"
2424
"os"
@@ -203,7 +203,7 @@ var commonTestScriptsParam = testscript.Params{
203203
}
204204

205205
defer resp.Body.Close()
206-
body, err := ioutil.ReadAll(resp.Body)
206+
body, err := io.ReadAll(resp.Body)
207207
if err != nil {
208208
return fmt.Errorf("failed to read response body: %v", err)
209209
}

tpl/internal/templatefuncsRegistry.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"go/doc"
2424
"go/parser"
2525
"go/token"
26-
"io/ioutil"
2726
"log"
2827
"os"
2928
"path/filepath"
@@ -276,7 +275,7 @@ func getGetTplPackagesGoDoc() map[string]map[string]methodGoDocInfo {
276275
basePath = filepath.Join(pwd, "tpl")
277276
}
278277

279-
files, err := ioutil.ReadDir(basePath)
278+
files, err := os.ReadDir(basePath)
280279
if err != nil {
281280
log.Fatal(err)
282281
}

0 commit comments

Comments
 (0)
0