Earlier this year we switched development to Go
. We're pretty big fans of the language, initially developed at our cloud partners Google. Since Google App Engine supports Go, you can easily integrate SendGrid's Go library on Google's platform-as-a-service.
- First, register an app in AppEngine for demo purposes.
- If you don’t have a SendGrid account, head on over to our Google Partnership page to find out more of the benefits.
- Modify your PATH to include the Go AppEngine binaries. After doing this, you shall have the goapp binary ready to run. To be sure you can run the following command:
which goappIt should print out the location of the goapp binary.
Using the Go package manager, you should just need one command to get the SendGrid library:
go get github.com/sendgrid/sendgrid-go
DONE! This will be available for all your future apps if you set up your GOPATH
Installing packages in Go is somewhat magical…You just install and there is no feedback.
If you are a bit more anal like me, and you like to have Version Numbering
, you should check out Godep
For this example I will use Martini
, my favorite Go Web Framework. If you want to see how this would look like in any other framework (or simply vanilla Go) I’d be more than glad to show you. Just ping me on twitter
So go ahead and run:
go get github.com/go-martini/martini
Now lets add some boilerplate code.