Skip to content

Commit fd38e10

Browse files
wmeintsyaron2artursouzadapr-bot
authored andcommitted
Fix warning in smtp binding when user and password are set (dapr#1256)
* Fix warning in smtp binding when user and password are set * Remove nolint comment Co-authored-by: Yaron Schneider <yaronsc@microsoft.com> Co-authored-by: Artur Souza <artursouza.ms@outlook.com> Co-authored-by: Dapr Bot <56698301+dapr-bot@users.noreply.github.com> Signed-off-by: Amit Mor <amitm@at-bay.com>
1 parent 02f6fad commit fd38e10

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bindings/smtp/smtp.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,12 @@ func (s *Mailer) parseMetadata(meta bindings.Metadata) (Metadata, error) {
135135
return smtpMeta, errors.New("smtp binding error: host and port fields are required in metadata")
136136
}
137137

138-
//nolint
139138
if (meta.Properties["user"] != "" && meta.Properties["password"] == "") ||
140139
(meta.Properties["user"] == "" && meta.Properties["password"] != "") {
141-
return smtpMeta, errors.New("smtp binding error: user and password fields are required in metadata")
142-
} else {
140+
return smtpMeta, errors.New("smtp binding error: both user and password fields are required in metadata")
141+
}
142+
143+
if meta.Properties["user"] == "" && meta.Properties["password"] == "" {
143144
s.logger.Warn("smtp binding warn: User and password are empty")
144145
}
145146

0 commit comments

Comments
 (0)