mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
refactor: move from io/ioutil to io and os packages
The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
parent
da8beb65bf
commit
1645759742
6 changed files with 17 additions and 23 deletions
|
@ -7,7 +7,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"net"
|
||||
"os"
|
||||
|
@ -1482,7 +1481,7 @@ func (c *Client) receiveData(i int) {
|
|||
c.FilesToTransfer[c.FilesToTransferCurrentNum].FolderRemote,
|
||||
c.FilesToTransfer[c.FilesToTransferCurrentNum].Name,
|
||||
)
|
||||
b, _ := ioutil.ReadFile(pathToFile)
|
||||
b, _ := os.ReadFile(pathToFile)
|
||||
fmt.Print(string(b))
|
||||
}
|
||||
log.Debug("sending close-sender")
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package croc
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sync"
|
||||
"testing"
|
||||
|
@ -153,7 +152,7 @@ func TestCrocLocal(t *testing.T) {
|
|||
|
||||
func TestCrocError(t *testing.T) {
|
||||
content := []byte("temporary file's content")
|
||||
tmpfile, err := ioutil.TempFile("", "example")
|
||||
tmpfile, err := os.CreateTemp("", "example")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue