app,gpu{,/headless,/internal/rendertest}: replace io/ioutil with io & os

Signed-off-by: Serhat Sevki Dincer <jfcgauss@gmail.com>
This commit is contained in:
Serhat Sevki Dincer
2023-02-23 21:47:27 +11:00
committed by Elias Naur
parent 1210bbb34a
commit 39b1158410
4 changed files with 7 additions and 9 deletions
+1 -2
View File
@@ -12,7 +12,6 @@ import (
"fmt" "fmt"
"image" "image"
"io" "io"
"io/ioutil"
"math" "math"
"os" "os"
"os/exec" "os/exec"
@@ -1018,7 +1017,7 @@ func (w *window) ReadClipboard() {
// Don't let slow clipboard transfers block event loop. // Don't let slow clipboard transfers block event loop.
go func() { go func() {
defer r.Close() defer r.Close()
data, _ := ioutil.ReadAll(r) data, _ := io.ReadAll(r)
w.clipReads <- clipboard.Event{Text: string(data)} w.clipReads <- clipboard.Event{Text: string(data)}
w.Wakeup() w.Wakeup()
}() }()
+2 -2
View File
@@ -12,9 +12,9 @@ import (
"image/color" "image/color"
"image/draw" "image/draw"
"image/png" "image/png"
"io/ioutil"
"math" "math"
"math/bits" "math/bits"
"os"
"runtime" "runtime"
"sort" "sort"
"time" "time"
@@ -655,7 +655,7 @@ func (g *compute) dumpAtlases() {
if err := png.Encode(&buf, nrgba); err != nil { if err := png.Encode(&buf, nrgba); err != nil {
panic(err) panic(err)
} }
if err := ioutil.WriteFile(fmt.Sprintf("dump-%d.png", i), buf.Bytes(), 0600); err != nil { if err := os.WriteFile(fmt.Sprintf("dump-%d.png", i), buf.Bytes(), 0600); err != nil {
panic(err) panic(err)
} }
} }
+2 -2
View File
@@ -8,7 +8,7 @@ import (
"image" "image"
"image/color" "image/color"
"image/png" "image/png"
"io/ioutil" "os"
"runtime" "runtime"
"testing" "testing"
@@ -202,5 +202,5 @@ func saveImage(file string, img image.Image) error {
if err := png.Encode(&buf, img); err != nil { if err := png.Encode(&buf, img); err != nil {
return err return err
} }
return ioutil.WriteFile(file, buf.Bytes(), 0666) return os.WriteFile(file, buf.Bytes(), 0666)
} }
+2 -3
View File
@@ -10,7 +10,6 @@ import (
"image/color" "image/color"
"image/draw" "image/draw"
"image/png" "image/png"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
@@ -161,7 +160,7 @@ func verifyRef(t *testing.T, img *image.RGBA, frame int) (ok bool) {
saveImage(t, path, img) saveImage(t, path, img)
return true return true
} }
b, err := ioutil.ReadFile(path) b, err := os.ReadFile(path)
if err != nil { if err != nil {
t.Error("could not open ref:", err) t.Error("could not open ref:", err)
return return
@@ -286,7 +285,7 @@ func saveImage(t testing.TB, file string, img *image.RGBA) {
t.Error(err) t.Error(err)
return return
} }
if err := ioutil.WriteFile(file, buf.Bytes(), 0666); err != nil { if err := os.WriteFile(file, buf.Bytes(), 0666); err != nil {
t.Error(err) t.Error(err)
return return
} }