Replace deprecated ioutil with io and os

https://pkg.go.dev/io/ioutil is deprecated since Go 1.16.
This commit is contained in:
Oleksandr Redko
2023-02-19 00:43:26 +02:00
committed by Bjørn Erik Pedersen
parent 97b010f521
commit d453c12742
36 changed files with 112 additions and 191 deletions

View File

@@ -17,7 +17,6 @@ import (
"bytes"
"errors"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -207,7 +206,7 @@ func (c *Cache) GetOrCreateBytes(id string, create func() ([]byte, error)) (Item
if r := c.getOrRemove(id); r != nil {
defer r.Close()
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
return info, b, err
}
@@ -242,7 +241,7 @@ func (c *Cache) GetBytes(id string) (ItemInfo, []byte, error) {
if r := c.getOrRemove(id); r != nil {
defer r.Close()
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
return info, b, err
}
@@ -314,7 +313,7 @@ func (c *Cache) getString(id string) string {
}
defer f.Close()
b, _ := ioutil.ReadAll(f)
b, _ := io.ReadAll(f)
return string(b)
}