Remove dependency of deprecated ioutil package
This commit is contained in:
@@ -4,8 +4,8 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -112,7 +112,7 @@ func loadTranslation(fsys fs.FS, fileName string) (translation translation, err
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
data, err := ioutil.ReadAll(file)
|
||||
data, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package nativeapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -26,7 +26,7 @@ var _ = Describe("Translations", func() {
|
||||
name := filepath.Base(f.Name())
|
||||
filePath := filepath.Join(consts.I18nFolder, name)
|
||||
file, _ := fs.Open(filePath)
|
||||
data, _ := ioutil.ReadAll(file)
|
||||
data, _ := io.ReadAll(file)
|
||||
var out map[string]interface{}
|
||||
|
||||
Expect(filepath.Ext(filePath)).To(Equal(".json"), filePath)
|
||||
|
||||
@@ -3,8 +3,8 @@ package server
|
||||
import (
|
||||
"encoding/json"
|
||||
"html/template"
|
||||
"io"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@@ -82,7 +82,7 @@ func getIndexTemplate(r *http.Request, fs fs.FS) (*template.Template, error) {
|
||||
log.Error(r, "Could not find `index.html` template", err)
|
||||
return nil, err
|
||||
}
|
||||
indexStr, err := ioutil.ReadAll(indexHtml)
|
||||
indexStr, err := io.ReadAll(indexHtml)
|
||||
if err != nil {
|
||||
log.Error(r, "Could not read from `index.html`", err)
|
||||
return nil, err
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http/httptest"
|
||||
|
||||
"github.com/navidrome/navidrome/model"
|
||||
@@ -76,5 +75,5 @@ func (c *fakeArtwork) Get(ctx context.Context, id string, size int) (io.ReadClos
|
||||
}
|
||||
c.recvId = id
|
||||
c.recvSize = size
|
||||
return ioutil.NopCloser(bytes.NewReader([]byte(c.data))), nil
|
||||
return io.NopCloser(bytes.NewReader([]byte(c.data))), nil
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package subsonic
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -67,7 +66,7 @@ func (c *StreamController) Stream(w http.ResponseWriter, r *http.Request) (*resp
|
||||
}
|
||||
|
||||
if r.Method == "HEAD" {
|
||||
go func() { _, _ = io.Copy(ioutil.Discard, stream) }()
|
||||
go func() { _, _ = io.Copy(io.Discard, stream) }()
|
||||
} else {
|
||||
if c, err := io.Copy(w, stream); err != nil {
|
||||
log.Error(ctx, "Error sending transcoded file", "id", id, err)
|
||||
|
||||
Reference in New Issue
Block a user