Skip to content

Commit 2cc6dc2

Browse files
committed
Remove deprecated ioutil functions
1 parent 537c005 commit 2cc6dc2

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

bot.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"errors"
88
"fmt"
99
"io"
10-
"io/ioutil"
1110
"mime/multipart"
1211
"net/http"
1312
"net/url"
@@ -151,7 +150,7 @@ func (bot *BotAPI) decodeAPIResponse(responseBody io.Reader, resp *APIResponse)
151150
}
152151

153152
// if debug, read response body
154-
data, err := ioutil.ReadAll(responseBody)
153+
data, err := io.ReadAll(responseBody)
155154
if err != nil {
156155
return nil, err
157156
}

bot_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package tgbotapi
22

33
import (
4-
"io/ioutil"
54
"net/http"
65
"os"
76
"testing"
@@ -139,7 +138,7 @@ func TestSendWithNewPhoto(t *testing.T) {
139138
func TestSendWithNewPhotoWithFileBytes(t *testing.T) {
140139
bot, _ := getBot(t)
141140

142-
data, _ := ioutil.ReadFile("tests/image.jpg")
141+
data, _ := os.ReadFile("tests/image.jpg")
143142
b := FileBytes{Name: "image.jpg", Bytes: data}
144143

145144
msg := NewPhoto(ChatID, b)
@@ -195,7 +194,7 @@ func TestSendNewPhotoToChannel(t *testing.T) {
195194
func TestSendNewPhotoToChannelFileBytes(t *testing.T) {
196195
bot, _ := getBot(t)
197196

198-
data, _ := ioutil.ReadFile("tests/image.jpg")
197+
data, _ := os.ReadFile("tests/image.jpg")
199198
b := FileBytes{Name: "image.jpg", Bytes: data}
200199

201200
msg := NewPhotoToChannel(Channel, b)

0 commit comments

Comments
 (0)