Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove named return values, per current idiomatic thinking.

  • Loading branch information...
commit 29d4e01d2aeff9ca22bd59f3e939eeab4f9032df 1 parent 06f655d
@gmallard authored
View
4 abort.go
@@ -29,12 +29,12 @@ package stompngo
// Do something sane ...
}
*/
-func (c *Connection) Abort(h Headers) (e error) {
+func (c *Connection) Abort(h Headers) error {
c.log(ABORT, "start")
if !c.connected {
return ECONBAD
}
- _, e = checkHeaders(h, c)
+ _, e := checkHeaders(h, c)
if e != nil {
return e
}
View
4 ack.go
@@ -31,12 +31,12 @@ package stompngo
}
*/
-func (c *Connection) Ack(h Headers) (e error) {
+func (c *Connection) Ack(h Headers) error {
c.log(ACK, "start")
if !c.connected {
return ECONBAD
}
- _, e = checkHeaders(h, c)
+ _, e := checkHeaders(h, c)
if e != nil {
return e
}
View
4 begin.go
@@ -30,12 +30,12 @@ package stompngo
// Do something sane ...
}
*/
-func (c *Connection) Begin(h Headers) (e error) {
+func (c *Connection) Begin(h Headers) error {
c.log(BEGIN, "start")
if !c.connected {
return ECONBAD
}
- _, e = checkHeaders(h, c)
+ _, e := checkHeaders(h, c)
if e != nil {
return e
}
View
4 commit.go
@@ -30,12 +30,12 @@ package stompngo
}
*/
-func (c *Connection) Commit(h Headers) (e error) {
+func (c *Connection) Commit(h Headers) error {
c.log(COMMIT, "start")
if !c.connected {
return ECONBAD
}
- _, e = checkHeaders(h, c)
+ _, e := checkHeaders(h, c)
if e != nil {
return e
}
View
8 connect.go
@@ -36,7 +36,7 @@ import (
}
// Use c
*/
-func Connect(n net.Conn, h Headers) (c *Connection, e error) {
+func Connect(n net.Conn, h Headers) (*Connection, error) {
if h == nil {
return nil, EHDRNIL
}
@@ -47,7 +47,7 @@ func Connect(n net.Conn, h Headers) (c *Connection, e error) {
return nil, ENORECPT
}
ch := h.Clone()
- c = &Connection{netconn: n,
+ c := &Connection{netconn: n,
input: make(chan MessageData, 1),
output: make(chan wiredata),
connected: false,
@@ -58,7 +58,7 @@ func Connect(n net.Conn, h Headers) (c *Connection, e error) {
c.MessageData = c.input
// Check that the cilent wants a version we support
- if e = c.checkClientVersions(h); e != nil {
+ if e := c.checkClientVersions(h); e != nil {
return c, e
}
@@ -69,7 +69,7 @@ func Connect(n net.Conn, h Headers) (c *Connection, e error) {
f := Frame{CONNECT, ch, NULLBUFF} // Create actual CONNECT frame
r := make(chan error) // Make the error channel fo a write
c.output <- wiredata{f, r} // Send the CONNECT frame
- e = <-r // Retrieve any error
+ e := <-r // Retrieve any error
//
if e != nil {
c.wsd <- true // Shutdown the writer, we are done with errors
View
4 datafuncs.go
@@ -125,8 +125,8 @@ func (h Headers) Value(k string) string {
Index returns the index of a keader key in Headers. Return -1 if the
key is not present.
*/
-func (h Headers) Index(k string) (r int) {
- r = -1
+func (h Headers) Index(k string) int {
+ r := -1
for i := 0; i < len(h); i += 2 {
if h[i] == k {
r = i
View
4 disconnect.go
@@ -32,12 +32,12 @@ package stompngo
}
*/
-func (c *Connection) Disconnect(h Headers) (e error) {
+func (c *Connection) Disconnect(h Headers) error {
c.log(DISCONNECT, "start")
if !c.connected {
return ECONBAD
}
- _, e = checkHeaders(h, c)
+ _, e := checkHeaders(h, c)
if e != nil {
return e
}
View
4 nack.go
@@ -32,7 +32,7 @@ package stompngo
}
*/
-func (c *Connection) Nack(h Headers) (e error) {
+func (c *Connection) Nack(h Headers) error {
c.log(NACK, "start")
if !c.connected {
return ECONBAD
@@ -40,7 +40,7 @@ func (c *Connection) Nack(h Headers) (e error) {
if c.protocol == SPL_10 {
return EBADVERNAK
}
- _, e = checkHeaders(h, c)
+ _, e := checkHeaders(h, c)
if e != nil {
return e
}
View
4 send.go
@@ -32,12 +32,12 @@ package stompngo
}
*/
-func (c *Connection) Send(h Headers, b string) (e error) {
+func (c *Connection) Send(h Headers, b string) error {
c.log(SEND, "start", h)
if !c.connected {
return ECONBAD
}
- _, e = checkHeaders(h, c)
+ _, e := checkHeaders(h, c)
if e != nil {
return e
}
View
6 subscribe.go
@@ -38,12 +38,12 @@ import (
}
*/
-func (c *Connection) Subscribe(h Headers) (s chan MessageData, e error) {
+func (c *Connection) Subscribe(h Headers) (chan MessageData, error) {
c.log(SUBSCRIBE, "start")
if !c.connected {
return nil, ECONBAD
}
- _, e = checkHeaders(h, c)
+ _, e := checkHeaders(h, c)
if e != nil {
return nil, e
}
@@ -54,7 +54,7 @@ func (c *Connection) Subscribe(h Headers) (s chan MessageData, e error) {
if _, ok := ch.Contains("ack"); !ok {
ch = ch.Add("ack", "auto")
}
- s, e, ch = c.establishSubscription(ch)
+ s, e, ch := c.establishSubscription(ch)
if e != nil {
return nil, e
}
View
4 unsubscribe.go
@@ -32,12 +32,12 @@ package stompngo
}
*/
-func (c *Connection) Unsubscribe(h Headers) (e error) {
+func (c *Connection) Unsubscribe(h Headers) error {
c.log(UNSUBSCRIBE, "start")
if !c.connected {
return ECONBAD
}
- _, e = checkHeaders(h, c)
+ _, e := checkHeaders(h, c)
if e != nil {
return e
}
View
5 utils.go
@@ -129,11 +129,10 @@ func connectResponse(s string) (f *Frame, e error) {
/*
Sha1 returns a SHA1 hash for a specified string.
*/
-func Sha1(q string) (s string) {
+func Sha1(q string) string {
g := sha1.New()
g.Write([]byte(q))
- s = fmt.Sprintf("%x", g.Sum(nil))
- return s
+ return fmt.Sprintf("%x", g.Sum(nil))
}
/*
Please sign in to comment.
Something went wrong with that request. Please try again.