Repository: ably/ably-go
Pull request #124 (2019-09-05 13:54:38)

Fixed some typos in comments


Patch:
diff --git a/ably/http_paginated_response.go b/ably/http_paginated_response.go
index 00946a1..662d969 100644
--- a/ably/http_paginated_response.go
+++ b/ably/http_paginated_response.go
@@ -47,7 +47,7 @@ func newHTTPPaginatedResultFromPaginatedResult(p *PaginatedResult) *HTTPPaginate
 	return h
 }
 
-// Next overides PaginatedResult.Next
+// Next overrides PaginatedResult.Next
 // spec HP2
 func (h *HTTPPaginatedResponse) Next() (*HTTPPaginatedResponse, error) {
 	p, err := h.PaginatedResult.Next()
diff --git a/ably/internal/ablyutil/msgpack.go b/ably/internal/ablyutil/msgpack.go
index 48efff9..b91bdae 100644
--- a/ably/internal/ablyutil/msgpack.go
+++ b/ably/internal/ablyutil/msgpack.go
@@ -27,7 +27,7 @@ func decodeMsg(r io.Reader, v interface{}) error {
 	return dec.Decode(v)
 }
 
-// Marshal retruns msgpack encoding of v
+// Marshal returns msgpack encoding of v
 func Marshal(v interface{}) ([]byte, error) {
 	var buf bytes.Buffer
 	err := encodeMsg(&buf, v)
diff --git a/ably/options.go b/ably/options.go
index 49fe4c8..e5b0918 100644
--- a/ably/options.go
+++ b/ably/options.go
@@ -117,7 +117,7 @@ type AuthOptions struct {
 	AuthParams url.Values
 
 	// UseQueryTime when set to true, the time queried from Ably servers will
-	// be used to sign the TokenRequest instread of using local time.
+	// be used to sign the TokenRequest instead of using local time.
 	UseQueryTime bool
 
 	// Spec: TO3j11
diff --git a/ably/proto/crypto.go b/ably/proto/crypto.go
index efba1ac..c854f8a 100644
--- a/ably/proto/crypto.go
+++ b/ably/proto/crypto.go
@@ -9,7 +9,7 @@ import (
 	"io"
 )
 
-// CipherAlgorithm algorithms used for channel enccryption.
+// CipherAlgorithm algorithms used for channel encryption.
 type CipherAlgorithm uint
 
 const (
@@ -77,7 +77,7 @@ type ChannelOptions struct {
 	cipher ChannelCipher
 }
 
-// GetCipher retruns a ChannelCipher based on the algorithms set in the
+// GetCipher returns a ChannelCipher based on the algorithms set in the
 // ChannelOptions.CipherParams.
 func (c *ChannelOptions) GetCipher() (ChannelCipher, error) {
 	if c.cipher != nil {
diff --git a/ably/realtime_channel.go b/ably/realtime_channel.go
index adef865..04fa952 100644
--- a/ably/realtime_channel.go
+++ b/ably/realtime_channel.go
@@ -222,7 +222,7 @@ func (c *RealtimeChannel) detach(result bool) (Result, error) {
 	return res, nil
 }
 
-// Closes initiaties closing sequence for the channel; it waits until the
+// Closes initiates closing sequence for the channel; it waits until the
 // operation is complete.
 //
 // If connection is already closed, this method is a nop.
diff --git a/ably/realtime_conn.go b/ably/realtime_conn.go
index 93f1dd5..94289bb 100644
--- a/ably/realtime_conn.go
+++ b/ably/realtime_conn.go
@@ -188,7 +188,7 @@ func (c *Conn) Key() string {
 // Ping issues a ping request against configured endpoint and returns TTR times
 // for ping request and pong response.
 //
-// Ping returns non-nil error without any attemp of communication with Ably
+// Ping returns non-nil error without any attempt of communication with Ably
 // if the connection state is StateConnClosed or StateConnFailed.
 func (c *Conn) Ping() (ping, pong time.Duration, err error) {
 	return 0, 0, errors.New("TODO")
@@ -223,12 +223,12 @@ func (c *Conn) State() StateEnum {
 //
 // If no states are given, c is registered for all of them.
 // If c is nil, the method panics.
-// If c is alreadt registered, its state set is expanded.
+// If c is already registered, its state set is expanded.
 func (c *Conn) On(ch chan<- State, states ...StateEnum) {
 	c.state.on(ch, states...)
 }
 
-// Off removes c from listetning on the given connection state transitions.
+// Off removes c from listening on the given connection state transitions.
 //
 // If no states are given, c is removed for all of the connection's states.
 // If c is nil, the method panics.
diff --git a/ably/realtime_presence.go b/ably/realtime_presence.go
index 5a30ce9..f39bd29 100644
--- a/ably/realtime_presence.go
+++ b/ably/realtime_presence.go
@@ -16,7 +16,7 @@ const (
 	syncComplete
 )
 
-// RealtimePresence represents a single presence map of a prarticular channel.
+// RealtimePresence represents a single presence map of a particular channel.
 // It allows entering, leaving and updating presence state for the current
 // client or on behalf of other client.
 type RealtimePresence struct {
diff --git a/ably/state.go b/ably/state.go
index f7bf81b..25e96e0 100644
--- a/ably/state.go
+++ b/ably/state.go
@@ -175,7 +175,7 @@ func stateError(state StateEnum, err error) error {
 }
 
 // State describes a single state transition of either realtime connection or channel
-// that occured due to some external condition (dropped connection, retried etc.).
+// that occurred due to some external condition (dropped connection, retried etc.).
 //
 // Each realtime connection and channel maintains its state to ensure high availability
 // and resilience, which is inherently asynchronous. In order to listen to transition


Test patch:
diff --git a/ably/ablytest/recorders.go b/ably/ablytest/recorders.go
index 250119a..e3005f4 100644
--- a/ably/ablytest/recorders.go
+++ b/ably/ablytest/recorders.go
@@ -211,7 +211,7 @@ func (rec *StateRecorder) Channel() chan<- ably.State {
 	return rec.ch
 }
 
-// Stop stops separate recording gorouting and waits until it terminates.
+// Stop stops separate recording goroutine and waits until it terminates.
 func (rec *StateRecorder) Stop() {
 	close(rec.done)
 	rec.wg.Wait()
diff --git a/ably/ablytest/resultgroup.go b/ably/ablytest/resultgroup.go
index c36b03e..44698c1 100644
--- a/ably/ablytest/resultgroup.go
+++ b/ably/ablytest/resultgroup.go
@@ -29,7 +29,7 @@ func Wait(res ably.Result, err error) error {
 // ResultGroup blocks till last added ably.Result has completed successfully.
 //
 // If at least ably.Result value failed, ResultGroup returns first encountered
-// error immadiately.
+// error immediately.
 type ResultGroup struct {
 	mu    sync.Mutex
 	wg    sync.WaitGroup
diff --git a/ably/auth_test.go b/ably/auth_test.go
index 26b268d..858e8bd 100644
--- a/ably/auth_test.go
+++ b/ably/auth_test.go
@@ -761,7 +761,7 @@ func TestAuth_CreateTokenRequest(t *testing.T) {
 				ts.Errorf("expected error code %d got %d", ably.ErrInvalidCredentials, e.Code)
 			}
 
-			// overide with bad key
+			// override with bad key
 			opts.Key = "some bad key"
 			_, err = client.Auth.CreateTokenRequest(params, opts)
 			if err == nil {