summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorguangwu <[email protected]>2023-06-17 11:27:57 +0800
committerGitHub <[email protected]>2023-06-16 21:27:57 -0600
commit4548b7de8e9880922a563c9d2d9f094b3c1f1622 (patch)
treec74ac421e0728fc19a1d26a23b0db29c12cbfdfe
parent3b19aa2b5a77440f8cb4d11e80937935d187f1cd (diff)
downloadcaddy-4548b7de8e9880922a563c9d2d9f094b3c1f1622.tar.gz
caddy-4548b7de8e9880922a563c9d2d9f094b3c1f1622.zip
chore: remove refs of deprecated io/ioutil (#5576)
-rw-r--r--modules/caddyhttp/templates/tplcontext_test.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/caddyhttp/templates/tplcontext_test.go b/modules/caddyhttp/templates/tplcontext_test.go
index 15a369ee8..fdf2c1065 100644
--- a/modules/caddyhttp/templates/tplcontext_test.go
+++ b/modules/caddyhttp/templates/tplcontext_test.go
@@ -18,7 +18,6 @@ import (
"bytes"
"context"
"fmt"
- "io/ioutil"
"net/http"
"os"
"path/filepath"
@@ -221,21 +220,21 @@ func TestNestedInclude(t *testing.T) {
// create files and for test case
if test.parentFile != "" {
absFilePath = filepath.Join(fmt.Sprintf("%s", context.Root), test.parentFile)
- if err := ioutil.WriteFile(absFilePath, []byte(test.parent), os.ModePerm); err != nil {
+ if err := os.WriteFile(absFilePath, []byte(test.parent), os.ModePerm); err != nil {
os.Remove(absFilePath)
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
}
}
if test.childFile != "" {
absFilePath0 = filepath.Join(fmt.Sprintf("%s", context.Root), test.childFile)
- if err := ioutil.WriteFile(absFilePath0, []byte(test.child), os.ModePerm); err != nil {
+ if err := os.WriteFile(absFilePath0, []byte(test.child), os.ModePerm); err != nil {
os.Remove(absFilePath0)
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
}
}
if test.child2File != "" {
absFilePath1 = filepath.Join(fmt.Sprintf("%s", context.Root), test.child2File)
- if err := ioutil.WriteFile(absFilePath1, []byte(test.child2), os.ModePerm); err != nil {
+ if err := os.WriteFile(absFilePath1, []byte(test.child2), os.ModePerm); err != nil {
os.Remove(absFilePath0)
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
}