mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
remove io/ioutil.
This commit is contained in:
parent
343b0c562a
commit
0501091c96
@ -3,7 +3,7 @@ package members
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
@ -16,7 +16,7 @@ type MemberBulkUpdatePayload struct {
|
||||
}
|
||||
|
||||
func (h *MembersHandler) membersBulkUpdate(w http.ResponseWriter, r *http.Request) {
|
||||
bytes, err := ioutil.ReadAll(r.Body)
|
||||
bytes, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, err)
|
||||
return
|
||||
|
@ -2,7 +2,6 @@ package room
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
@ -44,7 +43,7 @@ func (h *RoomHandler) uploadDrop(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
dir, err := ioutil.TempDir("", "neko-drop-*")
|
||||
dir, err := os.MkdirTemp("", "neko-drop-*")
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, err)
|
||||
return
|
||||
@ -108,7 +107,7 @@ func (h *RoomHandler) uploadDialogPost(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
dir, err := ioutil.TempDir("", "neko-dialog-*")
|
||||
dir, err := os.MkdirTemp("", "neko-dialog-*")
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, err)
|
||||
return
|
||||
|
@ -2,7 +2,7 @@ package file
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
@ -152,7 +152,7 @@ func (provider *MemberProviderCtx) deserialize() (map[string]MemberEntry, error)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
raw, err := ioutil.ReadAll(file)
|
||||
raw, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -189,5 +189,5 @@ func (provider *MemberProviderCtx) serialize(data map[string]MemberEntry) error
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(provider.config.Path, raw, os.ModePerm)
|
||||
return os.WriteFile(provider.config.Path, raw, os.ModePerm)
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@ -13,7 +13,7 @@ func HttpRequestGET(url string) (string, error) {
|
||||
}
|
||||
defer rsp.Body.Close()
|
||||
|
||||
buf, err := ioutil.ReadAll(rsp.Body)
|
||||
buf, err := io.ReadAll(rsp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user