Go: replaced iotuil functions with io equivalents

This commit is contained in:
JetSetIlly 2021-06-24 22:12:23 +01:00
parent 20b1755651
commit 40e10de6a3
9 changed files with 15 additions and 19 deletions

View file

@ -17,7 +17,6 @@ package database
import (
"io"
"io/ioutil"
"os"
"strconv"
"strings"
@ -168,7 +167,7 @@ func (db *Session) readDBFile() error {
return err
}
buffer, err := ioutil.ReadAll(db.dbfile)
buffer, err := io.ReadAll(db.dbfile)
if err != nil {
return curated.Errorf("database: %v", err)
}

View file

@ -16,7 +16,7 @@
package script
import (
"io/ioutil"
"io"
"os"
"strings"
@ -49,7 +49,7 @@ func RescribeScript(scriptfile string) (*Rescribe, error) {
}
defer f.Close()
buffer, err := ioutil.ReadAll(f)
buffer, err := io.ReadAll(f)
if err != nil {
return nil, curated.Errorf("script: %v", err)
}

View file

@ -17,7 +17,7 @@ package symbols
import (
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
"strconv"
@ -78,7 +78,7 @@ func (sym *Symbols) fromDasm(cart *cartridge.Cartridge) error {
}
defer sf.Close()
data, err := ioutil.ReadAll(sf)
data, err := io.ReadAll(sf)
if err != nil {
return curated.Errorf("dasm: processing error: %v", err)
}

View file

@ -17,7 +17,6 @@ package sdlimgui
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@ -34,7 +33,7 @@ type winSelectROM struct {
open bool
currPath string
entries []os.FileInfo
entries []os.DirEntry
err error
selectedFile string
@ -253,7 +252,7 @@ func (win *winSelectROM) setPath(path string) error {
var err error
win.currPath = filepath.Clean(path)
win.entries, err = ioutil.ReadDir(win.currPath)
win.entries, err = os.ReadDir(win.currPath)
win.selectedFile = ""
return err

View file

@ -19,7 +19,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"time"
@ -120,7 +120,7 @@ func (sess *Session) post(url string, data []byte) (int, []byte, error) {
defer resp.Body.Close()
// get response
response, err := ioutil.ReadAll(resp.Body)
response, err := io.ReadAll(resp.Body)
if err != nil {
return resp.StatusCode, []byte{}, err
}

View file

@ -19,7 +19,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strings"
@ -126,7 +125,7 @@ func Login(input io.Reader, output io.Writer, username string) error {
defer resp.Body.Close()
// get response
response, err := ioutil.ReadAll(resp.Body)
response, err := io.ReadAll(resp.Body)
if err != nil {
return curated.Errorf("hiscore: %v", err)
}

View file

@ -18,7 +18,6 @@ package patch
import (
"fmt"
"io"
"io/ioutil"
"os"
"strconv"
"strings"
@ -61,7 +60,7 @@ func CartridgeMemory(mem *cartridge.Cartridge, patchFile string) (bool, error) {
}
// read file
buffer, err := ioutil.ReadAll(f)
buffer, err := io.ReadAll(f)
if err != nil {
return false, curated.Errorf("patch: %v", err)
}

View file

@ -17,7 +17,7 @@ package prefs_test
import (
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
"testing"
@ -71,7 +71,7 @@ func cmpTmpFile(t *testing.T, fn string, expected string) {
}
defer f.Close()
data, err := ioutil.ReadAll(f)
data, err := io.ReadAll(f)
if err != nil {
t.Errorf("error reading tmp file: %v", err)
return

View file

@ -17,7 +17,7 @@ package recorder
import (
"fmt"
"io/ioutil"
"io"
"os"
"strconv"
"strings"
@ -91,7 +91,7 @@ func NewPlayback(transcript string) (*Playback, error) {
if err != nil {
return nil, curated.Errorf("playback: %v", err)
}
buffer, err := ioutil.ReadAll(tf)
buffer, err := io.ReadAll(tf)
if err != nil {
return nil, curated.Errorf("playback: %v", err)
}