From 783298a3a44a53451a32b6f4481b1a6be3f811bf Mon Sep 17 00:00:00 2001 From: Liam Stanley Date: Thu, 9 Nov 2017 20:42:40 -0500 Subject: [PATCH] additional return value consistency --- client.go | 12 ++++++------ format.go | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/client.go b/client.go index 1a4d4ac..6ebc0f1 100644 --- a/client.go +++ b/client.go @@ -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 diff --git a/format.go b/format.go index 5d32f8a..3cd65ba 100644 --- a/format.go +++ b/format.go @@ -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)