From 565297349e556606bbaa19f6f82d180ac6b49dfd Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Wed, 25 Sep 2024 16:51:32 -0400 Subject: [PATCH 1/2] Update module to Go 1.22. Swap out `github.com/pkg/errors` with `github.com/mailgun/errors`. --- email_validation.go | 2 +- go.mod | 16 ++++++++++++---- go.sum | 19 ++++++++++++++++--- httphelpers.go | 2 +- rfc2822.go | 2 +- tags_test.go | 2 +- template_test.go | 2 +- 7 files changed, 33 insertions(+), 12 deletions(-) diff --git a/email_validation.go b/email_validation.go index 9b60540..25cf252 100644 --- a/email_validation.go +++ b/email_validation.go @@ -7,7 +7,7 @@ import ( "os" "strings" - "github.com/pkg/errors" + "github.com/mailgun/errors" ) // The EmailVerificationParts structure breaks out the basic elements of an email address. diff --git a/go.mod b/go.mod index 535106c..b1ac5f5 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,20 @@ module github.com/mailgun/mailgun-go/v4 -go 1.13 +go 1.22 require ( github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 - github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect - github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect github.com/go-chi/chi/v5 v5.0.8 github.com/json-iterator/go v1.1.10 - github.com/pkg/errors v0.8.1 + github.com/mailgun/errors v0.3.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect + github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect + github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect + github.com/sirupsen/logrus v1.9.0 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/go.sum b/go.sum index df5dc4d..f69e9b0 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/ahmetb/go-linq v3.0.0+incompatible h1:qQkjjOXKrKOTy83X8OpRmnKflXKQIL/mC/gMVVDMhOA= +github.com/ahmetb/go-linq v3.0.0+incompatible/go.mod h1:PFffvbdbtw+QTB0WKRP0cNht7vnCfnGlEpak/DVg5cY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -12,14 +14,25 @@ github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITL github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/mailgun/errors v0.3.0 h1:g8R8lodkwqk5WIVMAClyUqt0PSd5JTVgobB+H7C2sLs= +github.com/mailgun/errors v0.3.0/go.mod h1:+ltknP+jhv3gZ1StKY6ugoQECcPxDCaSdmYesqTZcLQ= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/httphelpers.go b/httphelpers.go index b88f820..46f28b2 100644 --- a/httphelpers.go +++ b/httphelpers.go @@ -15,7 +15,7 @@ import ( "regexp" "strings" - "github.com/pkg/errors" + "github.com/mailgun/errors" ) var validURL = regexp.MustCompile(`/v[2-5].*`) diff --git a/rfc2822.go b/rfc2822.go index e02c112..26463b2 100644 --- a/rfc2822.go +++ b/rfc2822.go @@ -4,7 +4,7 @@ import ( "strconv" "time" - "github.com/pkg/errors" + "github.com/mailgun/errors" ) // RFC2822Time Mailgun uses RFC2822 format for timestamps everywhere ('Thu, 13 Oct 2011 18:02:00 GMT'), but diff --git a/tags_test.go b/tags_test.go index 3871eb2..2c67f85 100644 --- a/tags_test.go +++ b/tags_test.go @@ -6,8 +6,8 @@ import ( "time" "github.com/facebookgo/ensure" + "github.com/mailgun/errors" "github.com/mailgun/mailgun-go/v4" - "github.com/pkg/errors" ) const ( diff --git a/template_test.go b/template_test.go index cddbe26..351ac24 100644 --- a/template_test.go +++ b/template_test.go @@ -7,8 +7,8 @@ import ( "time" "github.com/facebookgo/ensure" + "github.com/mailgun/errors" "github.com/mailgun/mailgun-go/v4" - "github.com/pkg/errors" ) func TestTemplateCRUD(t *testing.T) { From dea03649174b4b559c955341b62972f58bf1b56a Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Wed, 25 Sep 2024 16:52:04 -0400 Subject: [PATCH 2/2] Fix go vet errors. --- events_test.go | 1 + examples_test.go | 8 ++++---- messages_test.go | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/events_test.go b/events_test.go index aa17d3d..ed655e9 100644 --- a/events_test.go +++ b/events_test.go @@ -73,6 +73,7 @@ func TestEventPoller(t *testing.T) { eventChan := make(chan mailgun.Event, 1) ctx, cancel := context.WithCancel(context.Background()) + defer cancel() go func() { // Poll until our email event arrives var page []mailgun.Event diff --git a/examples_test.go b/examples_test.go index 3081538..25c4132 100644 --- a/examples_test.go +++ b/examples_test.go @@ -15,7 +15,7 @@ import ( "github.com/mailgun/mailgun-go/v4/events" ) -func ExampleMailgunImpl_ValidateEmail() { +func ExampleEmailValidatorImpl_ValidateEmail() { v := mailgun.NewEmailValidator("my_public_validation_api_key") ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) @@ -35,7 +35,7 @@ func ExampleMailgunImpl_ValidateEmail() { } } -func ExampleMailgunImpl_ParseAddresses() { +func ExampleEmailValidatorImpl_ParseAddresses() { v := mailgun.NewEmailValidator("my_public_validation_api_key") ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) @@ -59,7 +59,7 @@ func ExampleMailgunImpl_ParseAddresses() { } } -func ExampleMailgunImpl_UpdateList() { +func ExampleMailgunImpl_UpdateMailingList() { mg := mailgun.NewMailgun("example.com", "my_api_key") ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) @@ -120,7 +120,7 @@ Testing some Mailgun MIME awesomeness! log.Printf("Message id=%s", id) } -func ExampleMailgunImpl_GetRoutes() { +func ExampleMailgunImpl_ListRoutes() { mg := mailgun.NewMailgun("example.com", "my_api_key") ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() diff --git a/messages_test.go b/messages_test.go index cd9fed3..25e8896 100644 --- a/messages_test.go +++ b/messages_test.go @@ -487,7 +487,6 @@ func TestSendEOFError(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { panic("") - return })) defer srv.Close()