Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: add go modules support #441

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions Dockerfile
Expand Up @@ -2,7 +2,7 @@ ARG version=latest
FROM golang:$version

ENV GODEBUG 'x509ignoreCN=0'
ENV GO111MODULE 'off'
ENV GO111MODULE 'auto'

COPY prism/prism/nginx/cert.crt /usr/local/share/ca-certificates/cert.crt
RUN update-ca-certificates
Expand All @@ -11,8 +11,3 @@ WORKDIR /go/src/github.com/sendgrid/sendgrid-go
COPY . .

RUN make install

# Use the last version of testify that works for older go versions, and then
# re-install to update dependencies.
RUN (cd /go/src/github.com/stretchr/testify && git checkout v1.6.0)
RUN make install
10 changes: 5 additions & 5 deletions README.md
@@ -1,7 +1,7 @@
![Twilio SendGrid Logo](twilio_sendgrid_logo.png)

[![BuildStatus](https://travis-ci.com/sendgrid/sendgrid-go.svg?branch=main)](https://travis-ci.com/sendgrid/sendgrid-go)
[![GoDoc](https://godoc.org/github.com/sendgrid/sendgrid-go?status.svg)](https://godoc.org/github.com/sendgrid/sendgrid-go)
[![GoDoc](https://godoc.org/github.com/sendgrid/sendgrid-go?status.svg)](https://pkg.go.dev/github.com/sendgrid/sendgrid-go/v4)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-go.svg)](https://github.com/sendgrid/sendgrid-go/graphs/contributors)
Expand Down Expand Up @@ -95,8 +95,8 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"
"github.com/sendgrid/sendgrid-go/v4"
"github.com/sendgrid/sendgrid-go/v4/helpers/mail"
)

func main() {
Expand Down Expand Up @@ -129,7 +129,7 @@ package main

import (
"fmt"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
"log"
"os"
)
Expand Down Expand Up @@ -176,7 +176,7 @@ package main

import (
"fmt"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
"log"
"os"
)
Expand Down
2 changes: 1 addition & 1 deletion USAGE.md
Expand Up @@ -7,7 +7,7 @@ package main

import (
"fmt"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
"log"
"os"
)
Expand Down
2 changes: 1 addition & 1 deletion base_interface.go
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"github.com/sendgrid/rest"
"github.com/sendgrid/sendgrid-go/helpers/mail"
"github.com/sendgrid/sendgrid-go/v4/helpers/mail"
)

// Version is this client library's current version
Expand Down
2 changes: 1 addition & 1 deletion examples/accesssettings/accesssettings.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

sendgrid "github.com/sendgrid/sendgrid-go"
sendgrid "github.com/sendgrid/sendgrid-go/v4"
)

// Retrieveallrecentaccessattempts : Retrieve all recent access attempts
Expand Down
2 changes: 1 addition & 1 deletion examples/alerts/alerts.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// CreateanewAlert : Create a new Alert
Expand Down
2 changes: 1 addition & 1 deletion examples/apikeys/apikeys.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

sendgrid "github.com/sendgrid/sendgrid-go"
sendgrid "github.com/sendgrid/sendgrid-go/v4"
)

// CreateAPIkeys : Create API keys
Expand Down
2 changes: 1 addition & 1 deletion examples/asm/asm.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Createanewsuppressiongroup : Create a new suppression group
Expand Down
2 changes: 1 addition & 1 deletion examples/browsers/browsers.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

sendgrid "github.com/sendgrid/sendgrid-go"
sendgrid "github.com/sendgrid/sendgrid-go/v4"
)

// Retrieveemailstatisticsbybrowser : Retrieve email statistics by browser.
Expand Down
2 changes: 1 addition & 1 deletion examples/campaigns/campaigns.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

sendgrid "github.com/sendgrid/sendgrid-go"
sendgrid "github.com/sendgrid/sendgrid-go/v4"
)

// CreateaCampaign : Create a Campaign
Expand Down
2 changes: 1 addition & 1 deletion examples/categories/categories.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Retrieveallcategories : Retrieve all categories
Expand Down
2 changes: 1 addition & 1 deletion examples/clients/clients.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Retrieveemailstatisticsbyclienttype : Retrieve email statistics by client type.
Expand Down
2 changes: 1 addition & 1 deletion examples/contactdb/contactdb.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// CreateaCustomField : Create a Custom Field
Expand Down
2 changes: 1 addition & 1 deletion examples/devices/devices.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Retrieveemailstatisticsbydevicetype : Retrieve email statistics by device type.
Expand Down
2 changes: 1 addition & 1 deletion examples/emailactivity/emailactivity.go
Expand Up @@ -6,7 +6,7 @@ import (
"net/url"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// GetMessages : Filter all messages
Expand Down
4 changes: 2 additions & 2 deletions examples/eventwebhook/eventwebhook.go
Expand Up @@ -6,8 +6,8 @@ import (
"os"

"github.com/sendgrid/rest"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/eventwebhook"
"github.com/sendgrid/sendgrid-go/v4"
"github.com/sendgrid/sendgrid-go/v4/helpers/eventwebhook"
)

// EnableSignedWebhook : Enables Signed Event Webhook.
Expand Down
2 changes: 1 addition & 1 deletion examples/geo/geo.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Retrieveemailstatisticsbycountryandstateprovince : Retrieve email statistics by country and state/province.
Expand Down
4 changes: 2 additions & 2 deletions examples/helpers/mail/example.go
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"
"github.com/sendgrid/sendgrid-go/v4"
"github.com/sendgrid/sendgrid-go/v4/helpers/mail"
)

// Minimum required to send an email
Expand Down
2 changes: 1 addition & 1 deletion examples/ips/ips.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// RetrieveallIPaddresses : Retrieve all IP addresses
Expand Down
2 changes: 1 addition & 1 deletion examples/mail/mail.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// CreateabatchID : Create a batch ID
Expand Down
2 changes: 1 addition & 1 deletion examples/mailboxproviders/mailboxproviders.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Retrieveemailstatisticsbymailboxprovider : Retrieve email statistics by mailbox provider.
Expand Down
2 changes: 1 addition & 1 deletion examples/mailsettings/mailsettings.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Retrieveallmailsettings : Retrieve all mail settings
Expand Down
2 changes: 1 addition & 1 deletion examples/partnersettings/partnersettings.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Returnsalistofallpartnersettings : Returns a list of all partner settings.
Expand Down
2 changes: 1 addition & 1 deletion examples/scopes/scopes.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Retrievealistofscopesforwhichthisuserhasaccess : Retrieve a list of scopes for which this user has access.
Expand Down
2 changes: 1 addition & 1 deletion examples/senderauthentication/senderauthentication.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Createadomainauthentication : Create a domain authentication.
Expand Down
2 changes: 1 addition & 1 deletion examples/senders/senders.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// CreateaSenderIdentity : Create a Sender Identity
Expand Down
2 changes: 1 addition & 1 deletion examples/stats/stats.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Retrieveglobalemailstatistics : Retrieve global email statistics
Expand Down
2 changes: 1 addition & 1 deletion examples/subusers/subusers.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// CreateSubuser : Creates a Subuser
Expand Down
2 changes: 1 addition & 1 deletion examples/suppression/suppression.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Retrieveallblocks : Retrieve all blocks
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/templates.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

sendgrid "github.com/sendgrid/sendgrid-go"
sendgrid "github.com/sendgrid/sendgrid-go/v4"
)

// Createatransactionaltemplate : Create a transactional template.
Expand Down
2 changes: 1 addition & 1 deletion examples/trackingsettings/trackingsettings.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// RetrieveTrackingSettings : Retrieve Tracking Settings
Expand Down
2 changes: 1 addition & 1 deletion examples/user/user.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/v4"
)

// Getausersaccountinformation : Get a user's account information.
Expand Down
9 changes: 9 additions & 0 deletions go.mod
@@ -0,0 +1,9 @@
module github.com/sendgrid/sendgrid-go/v4

go 1.16

require (
github.com/sendgrid/rest v2.6.5+incompatible
github.com/stretchr/testify v1.7.0
golang.org/x/net v0.0.0-20211007125505-59d4e928ea9d // indirect
)
20 changes: 20 additions & 0 deletions go.sum
@@ -0,0 +1,20 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/sendgrid/rest v2.6.5+incompatible h1:MZsDqRdwKTHXNABhVgiZFLgVDN698H4QtFrTX3WlrN0=
github.com/sendgrid/rest v2.6.5+incompatible/go.mod h1:kXX7q3jZtJXK5c5qK83bSGMdV6tsOE70KbHoqJls4lE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/net v0.0.0-20211007125505-59d4e928ea9d h1:QWMn1lFvU/nZ58ssWqiFJMd3DKIII8NYc4sn708XgKs=
golang.org/x/net v0.0.0-20211007125505-59d4e928ea9d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion helpers/inbound/README.md
Expand Up @@ -16,7 +16,7 @@ import (
"log"
"net/http"

"github.com/sendgrid/sendgrid-go/helpers/inbound"
"github.com/sendgrid/sendgrid-go/v4/helpers/inbound"
)

func inboundHandler(response http.ResponseWriter, request *http.Request) {
Expand Down