diff options
author | Sandro Santilli <strk@kbt.io> | 2016-11-07 21:58:22 +0100 |
---|---|---|
committer | Andrey Nering <andrey.nering@gmail.com> | 2016-11-07 18:58:22 -0200 |
commit | 864d1b1f9f6a72589d77ec0f08b21c476b8e13d4 (patch) | |
tree | ce425602ac6e31e6b7d4bc65e9591849e9ec96f9 /modules | |
parent | c8c748aea6a864c5cf8a2235d15f413188c0a22d (diff) | |
download | gitea-864d1b1f9f6a72589d77ec0f08b21c476b8e13d4.tar.gz gitea-864d1b1f9f6a72589d77ec0f08b21c476b8e13d4.zip |
Fix type in unused constant name (#111)
* Write LDAP, SMTP, PAM, DLDAP back to all uppercase
* Fix type in unused constant name
* Other MixCased fixes
* Complete MixerCasing of template constants
* Re uppercase LTS and LDAPS suffixes
* Uppercase JSON suffix in constant names
* Proper case LoginNoType
* Prefix unexported template path constants with "tpl"
Diffstat (limited to 'modules')
-rw-r--r-- | modules/auth/ldap/ldap.go | 8 | ||||
-rw-r--r-- | modules/log/smtp.go | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/modules/auth/ldap/ldap.go b/modules/auth/ldap/ldap.go index 361ca5817f..116feecc8b 100644 --- a/modules/auth/ldap/ldap.go +++ b/modules/auth/ldap/ldap.go @@ -21,8 +21,8 @@ type SecurityProtocol int // Note: new type must be added at the end of list to maintain compatibility. const ( SecurityProtocolUnencrypted SecurityProtocol = iota - SecurityProtocolLdaps - SecurityProtocolStartTls + SecurityProtocolLDAPS + SecurityProtocolStartTLS ) // Basic LDAP authentication service @@ -118,7 +118,7 @@ func dial(ls *Source) (*ldap.Conn, error) { ServerName: ls.Host, InsecureSkipVerify: ls.SkipVerify, } - if ls.SecurityProtocol == SecurityProtocolLdaps { + if ls.SecurityProtocol == SecurityProtocolLDAPS { return ldap.DialTLS("tcp", fmt.Sprintf("%s:%d", ls.Host, ls.Port), tlsCfg) } @@ -127,7 +127,7 @@ func dial(ls *Source) (*ldap.Conn, error) { return nil, fmt.Errorf("Dial: %v", err) } - if ls.SecurityProtocol == SecurityProtocolStartTls { + if ls.SecurityProtocol == SecurityProtocolStartTLS { if err = conn.StartTLS(tlsCfg); err != nil { conn.Close() return nil, fmt.Errorf("StartTLS: %v", err) diff --git a/modules/log/smtp.go b/modules/log/smtp.go index 0a10e56a63..0c87f0c704 100644 --- a/modules/log/smtp.go +++ b/modules/log/smtp.go @@ -17,7 +17,7 @@ const ( ) // smtpWriter implements LoggerInterface and is used to send emails via given SMTP-server. -type SmtpWriter struct { +type SMTPWriter struct { Username string `json:"Username"` Password string `json:"password"` Host string `json:"Host"` @@ -27,8 +27,8 @@ type SmtpWriter struct { } // create smtp writer. -func NewSmtpWriter() LoggerInterface { - return &SmtpWriter{Level: TRACE} +func NewSMTPWriter() LoggerInterface { + return &SMTPWriter{Level: TRACE} } // init smtp writer with json config. @@ -41,13 +41,13 @@ func NewSmtpWriter() LoggerInterface { // "sendTos":["email1","email2"], // "level":LevelError // } -func (sw *SmtpWriter) Init(jsonconfig string) error { +func (sw *SMTPWriter) Init(jsonconfig string) error { return json.Unmarshal([]byte(jsonconfig), sw) } // write message in smtp writer. // it will send an email with subject and only this message. -func (s *SmtpWriter) WriteMsg(msg string, skip, level int) error { +func (s *SMTPWriter) WriteMsg(msg string, skip, level int) error { if level < s.Level { return nil } @@ -76,12 +76,12 @@ func (s *SmtpWriter) WriteMsg(msg string, skip, level int) error { ) } -func (_ *SmtpWriter) Flush() { +func (_ *SMTPWriter) Flush() { } -func (_ *SmtpWriter) Destroy() { +func (_ *SMTPWriter) Destroy() { } func init() { - Register("smtp", NewSmtpWriter) + Register("smtp", NewSMTPWriter) } |