8000 Fix lint error for title casing by jhillyerd · Pull Request #6 · inbucket/fauxmailer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix lint error for title casing #6

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

Merged
merged 1 commit into from
Feb 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions main.go
745C
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (

"github.com/jhillyerd/enmime"
"github.com/manveru/faker"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)

var (
Expand All @@ -28,8 +30,9 @@ var (
tofile = flag.String("tofile", "", "optional file containing newline separated To addresses")
verbose = flag.Bool("verbose", false, "enable verbose output")

random = rand.New(rand.NewSource(time.Now().UnixNano()))
toaddrs []string
titleCaser = cases.Title(language.English)
random = rand.New(rand.NewSource(time.Now().UnixNano()))
toaddrs []string
)

func main() {
Expand Down Expand Up @@ -125,7 +128,7 @@ func generateMessage(fake *faker.Faker) enmime.MailBuilder {
return enmime.Builder().
From("", from).
To("", to).
Subject(strings.Title(fake.CompanyBs()) + " with " + company).
Subject(titleCaser.String(fake.CompanyBs()) + " with " + company).
Text([]byte(strings.Join(textp, "\r\n\r\n"))).
HTML([]byte("<p>" + strings.Join(htmlp, "</p>\r\n<p>") + "</p>"))
}
Expand Down
0