additional return value consistency

This commit is contained in:
Liam Stanley 2017-11-09 20:42:40 -05:00
parent 20a9ec00f5
commit 783298a3a4
2 changed files with 9 additions and 7 deletions

View File

@ -387,7 +387,7 @@ func (c *Client) ConnSince() (since *time.Duration, err error) {
}
// IsConnected returns true if the client is connected to the server.
func (c *Client) IsConnected() (connected bool) {
func (c *Client) IsConnected() bool {
c.mu.RLock()
if c.conn == nil {
c.mu.RUnlock()
@ -395,7 +395,7 @@ func (c *Client) IsConnected() (connected bool) {
}
c.conn.mu.RLock()
connected = c.conn.connected
connected := c.conn.connected
c.conn.mu.RUnlock()
c.mu.RUnlock()
@ -562,21 +562,21 @@ func (c *Client) NetworkName() (name string) {
// supplied this information during connection. May be empty if the server
// does not support RPL_MYINFO. Will panic if used when tracking has been
// disabled.
func (c *Client) ServerVersion() (version string) {
func (c *Client) ServerVersion() string {
c.panicIfNotTracking()
version, _ = c.GetServerOption("VERSION")
version, _ := c.GetServerOption("VERSION")
return version
}
// ServerMOTD returns the servers message of the day, if the server has sent
// it upon connect. Will panic if used when tracking has been disabled.
func (c *Client) ServerMOTD() (motd string) {
func (c *Client) ServerMOTD() string {
c.panicIfNotTracking()
c.state.RLock()
motd = c.state.motd
motd := c.state.motd
c.state.RUnlock()
return motd

View File

@ -291,7 +291,9 @@ func IsValidUser(name string) bool {
// ToRFC1459 converts a string to the stripped down conversion within RFC
// 1459. This will do things like replace an "A" with an "a", "[]" with "{}",
// and so forth. Useful to compare two nicknames or channels.
func ToRFC1459(input string) (out string) {
func ToRFC1459(input string) string {
var out string
for i := 0; i < len(input); i++ {
if input[i] >= 65 && input[i] <= 94 {
out += string(rune(input[i]) + 32)