From 14578f1fb3dfb79a4e27438a7ccef810bd6160f1 Mon Sep 17 00:00:00 2001 From: Lutz Horn Date: Wed, 23 Jan 2019 19:20:04 +0100 Subject: [PATCH] Make go vet happy with server example (#28) * added missing import of "io" in server example * make go vet happy by adding comments for exported methods * don't assign name to imported module --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 69746c0..09cd948 100755 --- a/README.md +++ b/README.md @@ -64,8 +64,10 @@ import ( "github.com/emersion/go-smtp" ) +// The Backend implements SMTP server methods. type Backend struct{} +// Login handles a login command with username and password. func (bkd *Backend) Login(username, password string) (smtp.User, error) { if username != "username" || password != "password" { return nil, errors.New("Invalid username or password") @@ -73,13 +75,15 @@ func (bkd *Backend) Login(username, password string) (smtp.User, error) { return &User{}, nil } -// Require clients to authenticate using SMTP AUTH before sending emails +// AnonymousLogin requires clients to authenticate using SMTP AUTH before sending emails func (bkd *Backend) AnonymousLogin() (smtp.User, error) { return nil, smtp.ErrAuthRequired } +// A User is returned after successful login. type User struct{} +// Send handles an email. func (u *User) Send(from string, to []string, r io.Reader) error { log.Println("Sending message:", from, to) @@ -91,6 +95,7 @@ func (u *User) Send(from string, to []string, r io.Reader) error { return nil } +// Logout handles logout. func (u *User) Logout() error { return nil }