all repos — telegram-bot-api @ 2cc6dc2458e8284a4580e32659c0dd265787a790

Golang bindings for the Telegram Bot API

Remove deprecated ioutil functions
Oleksandr Redko oleksandr.red+github@gmail.com
Wed, 19 Oct 2022 11:47:42 +0300
commit

2cc6dc2458e8284a4580e32659c0dd265787a790

parent

537c005643adee10686fa7d9bb860dec33a535d4

2 files changed, 3 insertions(+), 5 deletions(-)

jump to
M bot.gobot.go

@@ -7,7 +7,6 @@ "encoding/json"

"errors" "fmt" "io" - "io/ioutil" "mime/multipart" "net/http" "net/url"

@@ -151,7 +150,7 @@ return nil, err

} // if debug, read response body - data, err := ioutil.ReadAll(responseBody) + data, err := io.ReadAll(responseBody) if err != nil { return nil, err }
M bot_test.gobot_test.go

@@ -1,7 +1,6 @@

package tgbotapi import ( - "io/ioutil" "net/http" "os" "testing"

@@ -139,7 +138,7 @@

func TestSendWithNewPhotoWithFileBytes(t *testing.T) { bot, _ := getBot(t) - data, _ := ioutil.ReadFile("tests/image.jpg") + data, _ := os.ReadFile("tests/image.jpg") b := FileBytes{Name: "image.jpg", Bytes: data} msg := NewPhoto(ChatID, b)

@@ -195,7 +194,7 @@

func TestSendNewPhotoToChannelFileBytes(t *testing.T) { bot, _ := getBot(t) - data, _ := ioutil.ReadFile("tests/image.jpg") + data, _ := os.ReadFile("tests/image.jpg") b := FileBytes{Name: "image.jpg", Bytes: data} msg := NewPhotoToChannel(Channel, b)