0
0
Fork 0
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:
Eng Zer Jun 2021-11-17 11:25:52 +08:00
parent da8beb65bf
commit 1645759742
No known key found for this signature in database
GPG key ID: DAEBBD2E34C111E6
6 changed files with 17 additions and 23 deletions

View file

@ -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")

View file

@ -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)
}