Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 01:45 UTC
chore: remove refs of deprecated io/ioutil (#5576)
guangwu committed
Jun 17, 2023 at 11:27 UTC
4548b7de8e9880922a563c9d2d9f094b3c1f1622
1 file changed
+3
-4
modules/caddyhttp/templates/tplcontext_test.go
+3
-4
@@ -18,7 +18,6 @@ import (
18
"bytes"
19
"context"
20
"fmt"
21
- "io/ioutil"
21
"net/http"
22
"os"
23
"path/filepath"
@@ -221,21 +220,21 @@ func TestNestedInclude(t *testing.T) {
220
// create files and for test case
221
if test.parentFile != "" {
222
absFilePath = filepath.Join(fmt.Sprintf("%s", context.Root), test.parentFile)
224
- if err := ioutil.WriteFile(absFilePath, []byte(test.parent), os.ModePerm); err != nil {
223
+ if err := os.WriteFile(absFilePath, []byte(test.parent), os.ModePerm); err != nil {
224
os.Remove(absFilePath)
225
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
226
}
227
}
228
if test.childFile != "" {
229
absFilePath0 = filepath.Join(fmt.Sprintf("%s", context.Root), test.childFile)
231
- if err := ioutil.WriteFile(absFilePath0, []byte(test.child), os.ModePerm); err != nil {
230
+ if err := os.WriteFile(absFilePath0, []byte(test.child), os.ModePerm); err != nil {
231
os.Remove(absFilePath0)
232
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
233
}
234
}
235
if test.child2File != "" {
236
absFilePath1 = filepath.Join(fmt.Sprintf("%s", context.Root), test.child2File)
238
- if err := ioutil.WriteFile(absFilePath1, []byte(test.child2), os.ModePerm); err != nil {
237
+ if err := os.WriteFile(absFilePath1, []byte(test.child2), os.ModePerm); err != nil {
238
os.Remove(absFilePath0)
239
t.Fatalf("Test %d: Expected no error creating file, got: '%s'", i, err.Error())
240
}