-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from sendgrid/gmime3.2
TPOT-4847: Cleanup things for v1.0.0 release
- Loading branch information
Showing
104 changed files
with
2,153 additions
and
6,050 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,6 @@ src/ | |
bin/ginkgo | ||
go-gmime | ||
data/ | ||
local/ | ||
|
||
.idea/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ Kien Pham <[email protected]> | |
David McGuire <[email protected]> | ||
Vyacheslav "Kane" Kim <[email protected]> | ||
Alexander V. Nikolaev <[email protected]> | ||
Dustin Guerrero <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# valgrind only seems to work correctly with Go <= 1.17 (seeing an unknown instruction | ||
# error on higher versions) | ||
# admittedly, I haven't spent too much time trying to fix it but keep in mind | ||
# if you're trying to increase the Go version | ||
FROM golang:1.17-alpine3.16 | ||
RUN apk add gmime-dev build-base valgrind | ||
COPY . /go/src/github.com/sendgrid/go-gmime | ||
WORKDIR /go/src/github.com/sendgrid/go-gmime | ||
RUN ["go", "build", "./cmd/gmime/main.go"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
[![Build Status](https://travis-ci.org/sendgrid/go-gmime.svg?branch=master)](https://travis-ci.org/sendgrid/go-gmime) | ||
|
||
go-gmime | ||
======== | ||
|
||
|
@@ -8,91 +6,27 @@ This project is a binding of the C-based GMime library for Golang. | |
Dependencies | ||
--- | ||
|
||
- Go v. 1.2+ | ||
- GMime v. 2.6.19 or later, built with glib 2.38.0 or later. | ||
- Go1.17 | ||
- GMime >= v3.0 | ||
|
||
Usage | ||
--- | ||
|
||
Just add library with: | ||
|
||
go get github.com/sendgrid/go-gmime | ||
|
||
or using your favorite dependency manager (for example `godep` or `gom`) | ||
go get github.com/sendgrid/go-gmime/v1/gmime | ||
|
||
Setup for development | ||
--- | ||
|
||
For OSX | ||
|
||
# install required packages | ||
brew install go | ||
brew install gmime | ||
bin/install_deps | ||
|
||
On Ubuntu/Debian (trusty or jessie/sid, or later): | ||
|
||
# install go and required packages | ||
sudo apt-get install golang libgmime-2.6-dev | ||
|
||
Earlier Ubuntu like `12.04 (precise)` require to backport glib2 (version | ||
2.38.1 or later) and gmime-2.6 (2.6.19 or later) | ||
Follow instructions in ``doc/packages.md`` for details. | ||
|
||
``bin/install_dep`` also put symlink to package dir, so cloned dir accessable | ||
for import by full-qualified name ``github.com/sendgrid/go-gmime/gmime`` | ||
|
||
Compose Message | ||
--- | ||
|
||
```go | ||
|
||
composer := NewComposer() | ||
composer.AddFrom("Good Sender <[email protected]>") | ||
composer.AddTo("[email protected]", "Good Customer") | ||
|
||
// read data from a file: | ||
fileHandler, _ := os.Open("data.txt") | ||
defer fileHandler.Close() | ||
reader := bufio.NewReader(fileHandler) | ||
|
||
composer.AddHTML(reader) | ||
print(composer.GetMessage()) | ||
``` | ||
|
||
Parse Message | ||
--- | ||
|
||
```go | ||
|
||
// Example on how to create a NewParse | ||
|
||
fileHandler, _ := os.Open("fixtures/text_attachment.eml") | ||
defer fileHandler.Close() | ||
reader := bufio.NewReader(fileHandler) | ||
parse := NewParse(reader) | ||
|
||
fmt.Println(parse.From()) | ||
fmt.Println(parse.To()) | ||
fmt.Println(parse.Subject()) | ||
brew install go gmime | ||
|
||
// Output: | ||
// Dave McGuire <[email protected]> | ||
// Team R&D <[email protected]> | ||
// Distilled Content-Type headers (outbound & failed) | ||
|
||
``` | ||
|
||
Documentation | ||
Examples | ||
--- | ||
|
||
Use [https://developer.gnome.org/gmime/stable/|GMime Reference Manual] as | ||
documentation, this library have all classes/methods named very similiar with | ||
original ``GMime`` classes. | ||
|
||
All objects will be unreferenced (in terms of glib/gmime) when go-gmime | ||
provided wrappers will be collected by go runtime. | ||
|
||
See cmd/gmime/main.go for examples | ||
|
||
Testing / Coverage | ||
--- | ||
|
@@ -109,45 +43,12 @@ Testing / Coverage | |
# generate tests coverage | ||
bin/cover | ||
|
||
Vagrant VMs | ||
--- | ||
We use Ubuntu to run Valgrind and CentOS to match SendGrid production | ||
|
||
# setup the Vagrant vm box and access it: | ||
vagrant up go-gmime-centos | ||
vagrant up go-gmime-ubuntu | ||
|
||
# access a VM box | ||
vagrant ssh go-gmime-centos | ||
vagrant ssh go-gmime-ubuntu | ||
|
||
# run test on VM | ||
bin/testvm | ||
|
||
Benchmarks | ||
--- | ||
Create and copy test emails to the data/ directory at the root of this project. | ||
|
||
# benchmark using GMime binding | ||
go run bench/gmime/test.go | ||
|
||
# benchmark using native Go | ||
go run bench/native/test.go | ||
|
||
# benchmark using Perl | ||
perl bench/perl/test.pl | ||
|
||
# run integration GMime binding benchmark | ||
bin/bench | ||
|
||
Memory Check | ||
--- | ||
We use Valgrind with **go-gmime-ubuntu** VM to check for memory leak. Run the command below inside the VM and check valgrind.log | ||
We use Valgrind to check for memory leaks. The provided Dockerfile should setup a container ready to run Valgrind | ||
|
||
bin/valgrind | ||
|
||
(it require valgrind 3.9.x, 3.10.x is better, and gcc-go at least 4.9) | ||
|
||
Contributing | ||
--- | ||
# Don't forget to run gofmt before commiting | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.