Skip to content

Commit

Permalink
chore: remove refs to deprecated io/ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill committed Jul 23, 2023
1 parent 80aa0a2 commit eb90594
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions font.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package draw2d

import (
"io/ioutil"
"log"
"os"
"path/filepath"

"github.com/golang/freetype/truetype"
Expand Down Expand Up @@ -143,7 +143,7 @@ func (cache *FolderFontCache) Load(fontData FontData) (font *truetype.Font, err
var data []byte
var file = cache.namer(fontData)

if data, err = ioutil.ReadFile(filepath.Join(cache.folder, file)); err != nil {
if data, err = os.ReadFile(filepath.Join(cache.folder, file)); err != nil {
return
}

Expand Down Expand Up @@ -202,7 +202,7 @@ func (cache *SyncFolderFontCache) Load(fontData FontData) (font *truetype.Font,
var data []byte
var file = cache.namer(fontData)

if data, err = ioutil.ReadFile(filepath.Join(cache.folder, file)); err != nil {
if data, err = os.ReadFile(filepath.Join(cache.folder, file)); err != nil {
return
}

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module github.com/llgcode/draw2d

go 1.20

require (
github.com/go-gl/gl v0.0.0-20180407155706-68e253793080
github.com/go-gl/glfw v0.0.0-20180426074136-46a8d530c326
Expand Down
4 changes: 2 additions & 2 deletions samples/postscript/postscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package postscript

import (
"io/ioutil"
"io"
"os"
"strings"

Expand Down Expand Up @@ -40,7 +40,7 @@ func Draw(gc draw2d.GraphicContext, filename string) {
panic(err)
}
defer src.Close()
bytes, err := ioutil.ReadAll(src)
bytes, err := io.ReadAll(src)
reader := strings.NewReader(string(bytes))

// Initialize and interpret the postscript
Expand Down
4 changes: 2 additions & 2 deletions samples/postscriptgl/postscriptgl.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package main

import (
"io/ioutil"
"io"
"log"
"math"
"os"
Expand Down Expand Up @@ -69,7 +69,7 @@ func main() {
return
}
defer src.Close()
bytes, err := ioutil.ReadAll(src)
bytes, err := io.ReadAll(src)
postscriptContent = string(bytes)
err = glfw.Init()
if err != nil {
Expand Down

0 comments on commit eb90594

Please sign in to comment.