Skip to content

Commit

Permalink
email: use strconv.Itoa instead of sprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
hrfee committed Apr 2, 2021
1 parent dbe7e2e commit 30f16e7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions email.go
Expand Up @@ -11,6 +11,7 @@ import (
"io"
"net/smtp"
"os"
"strconv"
"strings"
"sync"
textTemplate "text/template"
Expand Down Expand Up @@ -108,13 +109,13 @@ func (emailer *Emailer) formatExpiry(expiry time.Time, tzaware bool, datePattern
}
_, _, days, hours, minutes, _ := timeDiff(expiry, currentTime)
if days != 0 {
expiresIn += fmt.Sprintf("%dd ", days)
expiresIn += strconv.Itoa(days) + "d "
}
if hours != 0 {
expiresIn += fmt.Sprintf("%dh ", hours)
expiresIn += strconv.Itoa(hours) + "h "
}
if minutes != 0 {
expiresIn += fmt.Sprintf("%dm ", minutes)
expiresIn += strconv.Itoa(minutes) + "m "
}
expiresIn = strings.TrimSuffix(expiresIn, " ")
return
Expand Down

0 comments on commit 30f16e7

Please sign in to comment.