1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-22 15:27:02 +00:00

docs: Add missing docstrings, adjust wording to match standard style

This patch adds a missing docstrings for exported identifiers, and
adjust some of the existing ones to match the standard style.

In some cases, the identifiers were un-exported after noticing they had
no external users.

Besides improving documentation, it also reduces the linter noise
significantly.
This commit is contained in:
Alberto Bertogli
2018-03-04 15:54:34 +00:00
parent 40ae9b5f69
commit f3b01cb493
21 changed files with 154 additions and 46 deletions

View File

@@ -19,16 +19,19 @@ func Split(addr string) (string, string) {
return ps[0], ps[1]
}
// UserOf user@domain returns user.
func UserOf(addr string) string {
user, _ := Split(addr)
return user
}
// DomainOf user@domain returns domain.
func DomainOf(addr string) string {
_, domain := Split(addr)
return domain
}
// DomainIn checks that the domain of the address is on the given set.
func DomainIn(addr string, locals *set.String) bool {
domain := DomainOf(addr)
if domain == "" {
@@ -38,6 +41,7 @@ func DomainIn(addr string, locals *set.String) bool {
return locals.Has(domain)
}
// AddHeader adds (prepends) a MIME header to the message.
func AddHeader(data []byte, k, v string) []byte {
if len(v) > 0 {
// If the value contains newlines, indent them properly.