From f0b09f78bf9cadf2363bdc5e4be6ddd40fed006e Mon Sep 17 00:00:00 2001 From: Gino Fazari Date: Thu, 22 Aug 2024 15:42:22 -0400 Subject: [PATCH] docs: update deprecated io.ReadFile with os.ReadFile As of Go 1.16, this function simply calls os.ReadFile. https://pkg.go.dev/io/ioutil#ReadFile --- use-cases/attachments-with-mailer-helper.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/use-cases/attachments-with-mailer-helper.md b/use-cases/attachments-with-mailer-helper.md index a6da7e5c..1687fa1e 100644 --- a/use-cases/attachments-with-mailer-helper.md +++ b/use-cases/attachments-with-mailer-helper.md @@ -8,7 +8,6 @@ import ( "log" "os" "encoding/base64" - "io/ioutil" "github.com/sendgrid/sendgrid-go" "github.com/sendgrid/sendgrid-go/helpers/mail" ) @@ -34,7 +33,7 @@ func main() { // read/attach .txt file a_txt := mail.NewAttachment() - dat, err := io.ReadFile("testing.txt") + dat, err := os.ReadFile("testing.txt") if err != nil { fmt.Println(err) } @@ -46,7 +45,7 @@ func main() { // read/attach .pdf file a_pdf := mail.NewAttachment() - dat, err = io.ReadFile("testing.pdf") + dat, err = os.ReadFile("testing.pdf") if err != nil { fmt.Println(err) } @@ -58,7 +57,7 @@ func main() { // read/attach inline .jpg file a_jpg := mail.NewAttachment() - dat, err = io.ReadFile("testing.jpg") + dat, err = os.ReadFile("testing.jpg") if err != nil { fmt.Println(err) }