Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Commit 6c6b048

Browse files
authored
Merge pull request #831 from tealeg/remove-deprecated-ioutil
Remove deprecated ioutil calls
2 parents acaf8a1 + d079e0b commit 6c6b048

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

diskv.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"encoding/binary"
66
"errors"
77
"fmt"
8-
"io/ioutil"
98
"math"
109
"os"
1110
"strings"
@@ -353,7 +352,7 @@ func NewDiskVCellStore() (CellStore, error) {
353352
buf: bytes.NewBuffer([]byte{}),
354353
}
355354

356-
dir, err := ioutil.TempDir("", cellStorePrefix+generator.Hex128())
355+
dir, err := os.MkdirTemp("", cellStorePrefix+generator.Hex128())
357356
if err != nil {
358357
return nil, err
359358
}

file_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package xlsx
33
import (
44
"encoding/xml"
55
"io"
6-
"io/ioutil"
76
"os"
87
"path/filepath"
98
"testing"
@@ -874,7 +873,7 @@ func TestFile(t *testing.T) {
874873

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

971970
// We can save a File as a valid XLSX file at a given path.
972971
csRunO(c, "TestSaveFileWithHyperlinks", func(c *qt.C, option FileOption) {
973-
tmpPath, err := ioutil.TempDir("", "testsavefilewithhyperlinks")
972+
tmpPath, err := os.MkdirTemp("", "testsavefilewithhyperlinks")
974973
c.Assert(err, qt.IsNil)
975974
defer os.RemoveAll(tmpPath)
976975
f := NewFile(option)

lib.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"errors"
88
"fmt"
99
"io"
10-
"io/ioutil"
1110
"path"
1211
"path/filepath"
1312
"regexp"
@@ -1281,7 +1280,7 @@ func truncateSheetXML(r io.Reader, rowLimit int) (io.Reader, error) {
12811280
// When sheets are truncated, most of formatting present will be not right, but all of this formatting
12821281
// is related to printing and visibility, and is out of scope for most purposes of this library.
12831282
func truncateSheetXMLValueOnly(r io.Reader) (io.Reader, error) {
1284-
sheetXML, err := ioutil.ReadAll(r)
1283+
sheetXML, err := io.ReadAll(r)
12851284
if err != nil {
12861285
return nil, err
12871286
}

sheet_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"archive/zip"
55
"bytes"
66
"encoding/xml"
7-
"io/ioutil"
7+
"io"
88
"path/filepath"
99
"strings"
1010
"testing"
@@ -421,7 +421,7 @@ func TestSheet(t *testing.T) {
421421
if f.Name == "xl/styles.xml" {
422422
rc, err := f.Open()
423423
c.Assert(err, qt.Equals, nil)
424-
obtained, err = ioutil.ReadAll(rc)
424+
obtained, err = io.ReadAll(rc)
425425
c.Assert(err, qt.Equals, nil)
426426
}
427427
}

0 commit comments

Comments
 (0)