Skip to content

Commit

Permalink
Remove deprecated ioutil calls
Browse files Browse the repository at this point in the history
  • Loading branch information
tealeg committed Nov 18, 2024
1 parent acaf8a1 commit d079e0b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions diskv.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/binary"
"errors"
"fmt"
"io/ioutil"
"math"
"os"
"strings"
Expand Down Expand Up @@ -353,7 +352,7 @@ func NewDiskVCellStore() (CellStore, error) {
buf: bytes.NewBuffer([]byte{}),
}

dir, err := ioutil.TempDir("", cellStorePrefix+generator.Hex128())
dir, err := os.MkdirTemp("", cellStorePrefix+generator.Hex128())
if err != nil {
return nil, err
}
Expand Down
5 changes: 2 additions & 3 deletions file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package xlsx
import (
"encoding/xml"
"io"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -874,7 +873,7 @@ func TestFile(t *testing.T) {

// We can save a File as a valid XLSX file at a given path.
csRunO(c, "TestSaveFile", func(c *qt.C, option FileOption) {
tmpPath, err := ioutil.TempDir("", "testsavefile")
tmpPath, err := os.MkdirTemp("", "testsavefile")
c.Assert(err, qt.IsNil)
defer os.RemoveAll(tmpPath)
f := NewFile(option)
Expand Down Expand Up @@ -970,7 +969,7 @@ func TestFile(t *testing.T) {

// We can save a File as a valid XLSX file at a given path.
csRunO(c, "TestSaveFileWithHyperlinks", func(c *qt.C, option FileOption) {
tmpPath, err := ioutil.TempDir("", "testsavefilewithhyperlinks")
tmpPath, err := os.MkdirTemp("", "testsavefilewithhyperlinks")
c.Assert(err, qt.IsNil)
defer os.RemoveAll(tmpPath)
f := NewFile(option)
Expand Down
3 changes: 1 addition & 2 deletions lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"path"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -1281,7 +1280,7 @@ func truncateSheetXML(r io.Reader, rowLimit int) (io.Reader, error) {
// When sheets are truncated, most of formatting present will be not right, but all of this formatting
// is related to printing and visibility, and is out of scope for most purposes of this library.
func truncateSheetXMLValueOnly(r io.Reader) (io.Reader, error) {
sheetXML, err := ioutil.ReadAll(r)
sheetXML, err := io.ReadAll(r)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions sheet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"archive/zip"
"bytes"
"encoding/xml"
"io/ioutil"
"io"
"path/filepath"
"strings"
"testing"
Expand Down Expand Up @@ -421,7 +421,7 @@ func TestSheet(t *testing.T) {
if f.Name == "xl/styles.xml" {
rc, err := f.Open()
c.Assert(err, qt.Equals, nil)
obtained, err = ioutil.ReadAll(rc)
obtained, err = io.ReadAll(rc)
c.Assert(err, qt.Equals, nil)
}
}
Expand Down

0 comments on commit d079e0b

Please sign in to comment.