Skip to content

Commit

Permalink
Update to Golang 1.22 (#330)
Browse files Browse the repository at this point in the history
- Swap out module `pkg/errors` with `mailgun/errors`.
  - See: pkg/errors#245
- Fix some `go vet` errors, too.
  • Loading branch information
Baliedge authored Sep 26, 2024
1 parent a1fcd33 commit fa30808
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 17 deletions.
2 changes: 1 addition & 1 deletion email_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
16 changes: 12 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
)
19 changes: 16 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand All @@ -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=
2 changes: 1 addition & 1 deletion httphelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"regexp"
"strings"

"github.com/pkg/errors"
"github.com/mailgun/errors"
)

var validURL = regexp.MustCompile(`/v[2-5].*`)
Expand Down
1 change: 0 additions & 1 deletion messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion rfc2822.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit fa30808

Please sign in to comment.