diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 45dbc4c3..f447a23c 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 20 strategy: matrix: - go: [ '1.14', '1.15', '1.16', '1.17' ] + go: [ '1.14', '1.15', '1.16', '1.17', '1.18', '1.19' ] env: DOCKER_LOGIN: ${{ secrets.DOCKER_USERNAME && secrets.DOCKER_AUTH_TOKEN }} steps: diff --git a/README.md b/README.md index a8042e11..6a2130cd 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ This library supports the following Go implementations: * Go 1.15 * Go 1.16 * Go 1.17 +* Go 1.18 +* Go 1.19 ## Prerequisites diff --git a/helpers/inbound/inbound.go b/helpers/inbound/inbound.go index 3c688fca..ba7f0b89 100644 --- a/helpers/inbound/inbound.go +++ b/helpers/inbound/inbound.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "mime" "mime/multipart" "net/http" @@ -184,7 +183,7 @@ func (email *ParsedEmail) parseRawEmail(rawEmail string) error { break } header := emailBodyPart.Header.Get("Content-Type") - b, err := ioutil.ReadAll(emailPart) + b, err := io.ReadAll(emailPart) if err != nil { return err } @@ -192,14 +191,14 @@ func (email *ParsedEmail) parseRawEmail(rawEmail string) error { } } else if emailPart.FileName() != "" { - b, err := ioutil.ReadAll(emailPart) + b, err := io.ReadAll(emailPart) if err != nil { return err } email.Attachments[emailPart.FileName()] = b } else { header := emailPart.Header.Get("Content-Type") - b, err := ioutil.ReadAll(emailPart) + b, err := io.ReadAll(emailPart) if err != nil { return err } diff --git a/helpers/inbound/inbound_test.go b/helpers/inbound/inbound_test.go index d776f767..4dac61ab 100644 --- a/helpers/inbound/inbound_test.go +++ b/helpers/inbound/inbound_test.go @@ -3,16 +3,16 @@ package inbound import ( "bytes" "fmt" - "io/ioutil" "log" "net/http" + "os" "testing" "github.com/stretchr/testify/assert" ) func createRequest(filename string) *http.Request { - file, err := ioutil.ReadFile(filename) + file, err := os.ReadFile(filename) if err != nil { return nil } diff --git a/sendgrid_test.go b/sendgrid_test.go index 974a5ef8..f4557bd6 100644 --- a/sendgrid_test.go +++ b/sendgrid_test.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" "net/http" "net/http/httptest" "os" @@ -19,7 +18,7 @@ import ( ) func TestLicenseYear(t *testing.T) { - d, err := ioutil.ReadFile("LICENSE") + d, err := os.ReadFile("LICENSE") assert.Nil(t, err, "Cannot read the LICENSE file") l := fmt.Sprintf("Copyright (C) %v, Twilio SendGrid, Inc.", time.Now().Year()) assert.True(t, strings.Contains(string(d), l), fmt.Sprintf("License date range is not correct, it should be: %v", l)) diff --git a/use-cases/attachments-with-mailer-helper.md b/use-cases/attachments-with-mailer-helper.md index 88d0ffeb..a6da7e5c 100644 --- a/use-cases/attachments-with-mailer-helper.md +++ b/use-cases/attachments-with-mailer-helper.md @@ -34,7 +34,7 @@ func main() { // read/attach .txt file a_txt := mail.NewAttachment() - dat, err := ioutil.ReadFile("testing.txt") + dat, err := io.ReadFile("testing.txt") if err != nil { fmt.Println(err) } @@ -46,7 +46,7 @@ func main() { // read/attach .pdf file a_pdf := mail.NewAttachment() - dat, err = ioutil.ReadFile("testing.pdf") + dat, err = io.ReadFile("testing.pdf") if err != nil { fmt.Println(err) } @@ -58,7 +58,7 @@ func main() { // read/attach inline .jpg file a_jpg := mail.NewAttachment() - dat, err = ioutil.ReadFile("testing.jpg") + dat, err = io.ReadFile("testing.jpg") if err != nil { fmt.Println(err) }