Fix code formatting with gofmt -s

This commit is contained in:
Bernhard Froehlich
2021-04-03 19:00:38 +00:00
parent 7b199cc6ae
commit 441a53cfd9
4 changed files with 35 additions and 38 deletions

View File

@@ -7,8 +7,8 @@ import (
"regexp"
"strings"
"github.com/vharitonsky/iniflags"
"github.com/sirupsen/logrus"
"github.com/vharitonsky/iniflags"
)
var (
@@ -47,7 +47,6 @@ func localAuthRequired() bool {
return *allowedUsers != ""
}
func setupAllowedNetworks() {
for _, netstr := range splitstr(*allowedNetsStr, ' ') {
baseIP, allowedNet, err := net.ParseCIDR(netstr)
@@ -73,7 +72,7 @@ func setupAllowedNetworks() {
func setupAllowedPatterns() {
var err error
if (*allowedSenderStr != "") {
if *allowedSenderStr != "" {
allowedSender, err = regexp.Compile(*allowedSenderStr)
if err != nil {
log.WithField("allowed_sender", *allowedSenderStr).
@@ -82,7 +81,7 @@ func setupAllowedPatterns() {
}
}
if (*allowedRecipStr != "") {
if *allowedRecipStr != "" {
allowedRecipients, err = regexp.Compile(*allowedRecipStr)
if err != nil {
log.WithField("allowed_recipients", *allowedRecipStr).
@@ -92,7 +91,6 @@ func setupAllowedPatterns() {
}
}
func setupRemoteAuth() {
logger := log.WithField("remote_auth", *remoteAuthStr)
@@ -150,7 +148,7 @@ func splitProto(s string) protoAddr {
}
return protoAddr{
protocol: s[0:idx],
address: s[idx+3 : len(s)],
address: s[idx+3:],
}
}
@@ -164,7 +162,6 @@ func setupListeners() {
"not allowed with non-TLS listener")
}
listenAddrs = append(listenAddrs, pa)
}
}
@@ -175,7 +172,7 @@ func ConfigLoad() {
// Set up logging as soon as possible
setupLogger()
if (*remoteHost == "") {
if *remoteHost == "" {
log.Warn("remote_host not set; mail will not be forwarded!")
}

View File

@@ -16,7 +16,7 @@ func setupLogger() {
log = logrus.New()
// Handle logfile
if (*logFile == "") {
if *logFile == "" {
log.SetOutput(os.Stderr)
} else {
writer, err := os.OpenFile(*logFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0600)

View File

@@ -163,7 +163,7 @@ func mailHandler(peer smtpd.Peer, env smtpd.Envelope) error {
"uuid": generateUUID(),
})
if (*remoteHost == "") {
if *remoteHost == "" {
logger.Warning("remote_host not set; discarding mail")
return nil
}