Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
Signed-off-by: Arve Knudsen <[email protected]>
  • Loading branch information
aknuds1 committed Dec 8, 2021
1 parent 64c9ed1 commit 9ca8ee0
Show file tree
Hide file tree
Showing 31 changed files with 114 additions and 114 deletions.
18 changes: 9 additions & 9 deletions document/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
// - document field tag is "-"
// - document field tag specifies "omitempty", and is a zero value.
//
// Pointer and interfaces values are encoded as the value pointed to or
// Pointer and interface values are encoded as the value pointed to or
// contained in the interface. A nil value encodes as a null
// value unless `omitempty` struct tag is provided.
//
Expand All @@ -46,22 +46,22 @@ import (
// time.Time is not supported and will cause the Marshaler to return an error. These values should be represented
// by your application as a string or numerical representation.
//
// Errors that occur when marshaling will stop the marshaller, and return the error.
// Errors that occur when marshaling will stop the marshaler, and return the error.
//
// Marshal cannot represent cyclic data structures and will not handle them.
// Passing cyclic structures to Marshal will result in an infinite recursion.
type Marshaler interface {
MarshalSmithyDocument() ([]byte, error)
}

// Unmarshaler is an interface for a type that unmarshalls a document from its protocol-specific representation, and
// Unmarshaler is an interface for a type that unmarshals a document from its protocol-specific representation, and
// stores the result into the value pointed by v. If v is nil or not a pointer then InvalidUnmarshalError will be
// returned.
//
// Unmarshaler supports the same encodings produced by a document Marshaler. This includes support for the `document`
// struct field tag for controlling how struct fields are unmarshalled.
// struct field tag for controlling how struct fields are unmarshaled.
//
// Both generic interface{} and concrete types are valid unmarshal destination types. When unmarshalling a document
// Both generic interface{} and concrete types are valid unmarshal destination types. When unmarshaling a document
// into an empty interface the Unmarshaler will store one of these values:
// bool, for boolean values
// document.Number, for arbitrary-precision numbers (int64, float64, big.Int, big.Float)
Expand All @@ -70,7 +70,7 @@ type Marshaler interface {
// map[string]interface{}, for objects
// nil, for null values
//
// When unmarshalling, any error that occurs will halt the unmarshal and return the error.
// When unmarshaling, any error that occurs will halt the unmarshal and return the error.
type Unmarshaler interface {
UnmarshalSmithyDocument(v interface{}) error
}
Expand All @@ -79,7 +79,7 @@ type noSerde interface {
noSmithyDocumentSerde()
}

// NoSerde is a sentinel value to indicate that a given type should not be marshaled or unmarshalled
// NoSerde is a sentinel value to indicate that a given type should not be marshaled or unmarshaled
// into a protocol document.
type NoSerde struct{}

Expand All @@ -93,7 +93,7 @@ func IsNoSerde(x interface{}) bool {
return ok
}

// Number is a arbitrary precision numerical value
// Number is an arbitrary precision numerical value
type Number string

// Int64 returns the number as a string.
Expand All @@ -110,7 +110,7 @@ func (n Number) intOfBitSize(bitSize int) (int64, error) {
return strconv.ParseInt(string(n), 10, bitSize)
}

// Uint64 returns the number as an uint64.
// Uint64 returns the number as a uint64.
func (n Number) Uint64() (uint64, error) {
return n.uintOfBitSize(64)
}
Expand Down
20 changes: 10 additions & 10 deletions document/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ import (
"reflect"
)

// UnmarshalTypeError is an error type representing aa error
// unmarshalling a Smithy document to a Go value type. This is different
// UnmarshalTypeError is an error type representing an error
// unmarshaling a Smithy document to a Go value type. This is different
// from UnmarshalError in that it does not wrap an underlying error type.
type UnmarshalTypeError struct {
Value string
Type reflect.Type
}

// Error returns the string representation of the error.
// satisfying the error interface
// Satisfying the error interface.
func (e *UnmarshalTypeError) Error() string {
return fmt.Sprintf("unmarshal failed, cannot unmarshal %s into Go value type %s",
e.Value, e.Type.String())
}

// An InvalidUnmarshalError is an error type representing an invalid type
// encountered while unmarshalling a Smithy document to a Go value type.
// encountered while unmarshaling a Smithy document to a Go value type.
type InvalidUnmarshalError struct {
Type reflect.Type
}

// Error returns the string representation of the error.
// satisfying the error interface
// Satisfying the error interface.
func (e *InvalidUnmarshalError) Error() string {
var msg string
if e.Type == nil {
Expand All @@ -41,7 +41,7 @@ func (e *InvalidUnmarshalError) Error() string {
return fmt.Sprintf("unmarshal failed, %s", msg)
}

// An UnmarshalError wraps an error that occurred while unmarshalling a
// An UnmarshalError wraps an error that occurred while unmarshaling a
// Smithy document into a Go type. This is different from
// UnmarshalTypeError in that it wraps the underlying error that occurred.
type UnmarshalError struct {
Expand All @@ -50,13 +50,13 @@ type UnmarshalError struct {
Type reflect.Type
}

// Unwrap returns the underlying unmarshalling error
// Unwrap returns the underlying unmarshaling error
func (e *UnmarshalError) Unwrap() error {
return e.Err
}

// Error returns the string representation of the error satisfying the error
// interface.
// Error returns the string representation of the error.
// Satisfying the error interface.
func (e *UnmarshalError) Error() string {
return fmt.Sprintf("unmarshal failed, cannot unmarshal %q into %s, %v",
e.Value, e.Type.String(), e.Err)
Expand All @@ -69,7 +69,7 @@ type InvalidMarshalError struct {
}

// Error returns the string representation of the error.
// satisfying the error interface
// Satisfying the error interface.
func (e *InvalidMarshalError) Error() string {
return fmt.Sprintf("marshal failed, %s", e.Message)
}
6 changes: 3 additions & 3 deletions encoding/httpbinding/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewEncoder(path, query string, headers http.Header) (*Encoder, error) {
// Due net/http requiring `Content-Length` to be specified on the http.Request#ContentLength directly. Encode
// will look for whether the header is present, and if so will remove it and set the respective value on http.Request.
//
// Returns any error if one occurred during encoding.
// Returns any error occurring during encoding.
func (e *Encoder) Encode(req *http.Request) (*http.Request, error) {
req.URL.Path, req.URL.RawPath = string(e.path), string(e.rawPath)
req.URL.RawQuery = e.query.Encode()
Expand Down Expand Up @@ -80,7 +80,7 @@ func (e *Encoder) SetHeader(key string) HeaderValue {
return newHeaderValue(e.header, key, false)
}

// Headers returns a Header used encoding headers with the given prefix
// Headers returns a Header used for encoding headers with the given prefix
func (e *Encoder) Headers(prefix string) Headers {
return Headers{
header: e.header,
Expand Down Expand Up @@ -110,7 +110,7 @@ func (e *Encoder) AddQuery(key string) QueryValue {
}

// HasQuery returns if a query with the key specified exists with one or
// more value.
// more values.
func (e *Encoder) HasQuery(key string) bool {
return len(e.query.Get(key)) != 0
}
2 changes: 1 addition & 1 deletion encoding/json/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
)

// Array represent the encoding of a JSON Array
// Array represents the encoding of a JSON Array
type Array struct {
w *bytes.Buffer
writeComma bool
Expand Down
4 changes: 2 additions & 2 deletions encoding/json/decoder_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"io"
)

// DiscardUnknownField discards unknown fields from decoder body.
// This function is useful while deserializing json body with additional
// DiscardUnknownField discards unknown fields from a decoder body.
// This function is useful while deserializing a JSON body with additional
// unknown information that should be discarded.
func DiscardUnknownField(decoder *json.Decoder) error {
// This deliberately does not share logic with CollectUnknownField, even
Expand Down
2 changes: 1 addition & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (e *OperationError) Error() string {
return fmt.Sprintf("operation error %s: %s, %v", e.ServiceID, e.OperationName, e.Err)
}

// DeserializationError provides a wrapper for and error that occurs during
// DeserializationError provides a wrapper for an error that occurs during
// deserialization.
type DeserializationError struct {
Err error // original error
Expand Down
4 changes: 2 additions & 2 deletions io/ringbuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewRingBuffer(slice []byte) *RingBuffer {
return &ringBuf
}

// Write method inserts the elements in a byte slice, and returns the number of bytes written along with an error.
// Write method inserts the elements in a byte slice, and returns the number of bytes written along with any error.
func (r *RingBuffer) Write(p []byte) (int, error) {
for _, b := range p {
// check if end points to invalid index, we need to circle back
Expand All @@ -49,7 +49,7 @@ func (r *RingBuffer) Write(p []byte) (int, error) {
}

// Read copies the data on the ring buffer into the byte slice provided to the method.
// Returns the read count along with Error encountered while reading
// Returns the read count along with any error encountered while reading.
func (r *RingBuffer) Read(p []byte) (int, error) {
// readCount keeps track of the number of bytes read
var readCount int
Expand Down
2 changes: 1 addition & 1 deletion logging/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
)

// Classification the log entry's classification name
// Classification is the type of the log entry's classification name.
type Classification string

// Set of standard classifications that can be used by clients and middleware
Expand Down
10 changes: 5 additions & 5 deletions middleware/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package middleware provide transport agnostic middleware for decorating SDK
// Package middleware provides transport agnostic middleware for decorating SDK
// handlers.
//
// The Smithy middleware stack provides ordered behavior to be invoked on an
Expand All @@ -24,7 +24,7 @@
// order by the Stack. These steps represent fixed points in the middleware stack
// for organizing specific behavior, such as serialize and build. A Stack Step is
// composed of zero or more middleware that are specific to that step. A step may
// define its on set of input/output parameters the generic input/output
// define its own set of input/output parameters the generic input/output
// parameters are cast from. A step calls its middleware recursively, before
// calling the next step in the stack returning the result or error of the step
// middleware decorating the underlying handler.
Expand All @@ -39,7 +39,7 @@
// HTTP's Content-Length header, or body checksum). Decorations and
// modifications to the message should be copied to all message attempts.
//
// * Finalize: Preforms final preparations needed before sending the message. The
// * Finalize: Performs final preparations needed before sending the message. The
// message should already be complete by this stage, and is only alternated to
// meet the expectations of the recipient, (e.g. Retry and AWS SigV4 request
// signing).
Expand All @@ -51,8 +51,8 @@
// Adding Middleware to a Stack Step
//
// Middleware can be added to a step front or back, or relative, by name, to an
// existing middleware in that stack. If a middleware does not have a name a
// unique name will be generated at the middleware is added to the step.
// existing middleware in that stack. If a middleware does not have a name, a
// unique name will be generated at the middleware and be added to the step.
//
// // Create middleware stack
// stack := middleware.NewStack()
Expand Down
4 changes: 2 additions & 2 deletions middleware/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (m Metadata) Clone() Metadata {
// that key it will be replaced with the new value.
//
// Set method must be called as an addressable value, or pointer. If Set is not
// called as a addressable value or pointer, the key value pair being set may
// called as an addressable value or pointer, the key value pair being set may
// be lost.
//
// Panics if the key type is not comparable.
Expand All @@ -53,7 +53,7 @@ func (m *Metadata) Set(key, value interface{}) {
m.values[key] = value
}

// Has returns if the key exists in the metadata.
// Has returns whether the key exists in the metadata.
//
// Panics if the key type is not comparable.
func (m Metadata) Has(key interface{}) bool {
Expand Down
14 changes: 7 additions & 7 deletions middleware/ordered_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (g *orderedIDs) Add(m ider, pos RelativePosition) error {
return nil
}

// Insert injects the item relative to an existing item id. Return error if
// Insert injects the item relative to an existing item id. Returns an error if
// the original item does not exist, or the item being added already exists.
func (g *orderedIDs) Insert(m ider, relativeTo string, pos RelativePosition) error {
if len(m.ID()) == 0 {
Expand All @@ -66,13 +66,13 @@ func (g *orderedIDs) Insert(m ider, relativeTo string, pos RelativePosition) err
return nil
}

// Get returns the ider identified by id. If ider is not present, returns false
// Get returns the ider identified by id. If ider is not present, returns false.
func (g *orderedIDs) Get(id string) (ider, bool) {
v, ok := g.items[id]
return v, ok
}

// Swap removes the item by id, replacing it with the new item. Returns error
// Swap removes the item by id, replacing it with the new item. Returns an error
// if the original item doesn't exist.
func (g *orderedIDs) Swap(id string, m ider) (ider, error) {
if len(id) == 0 {
Expand All @@ -96,7 +96,7 @@ func (g *orderedIDs) Swap(id string, m ider) (ider, error) {
return removed, nil
}

// Remove removes the item by id. Returns error if the item
// Remove removes the item by id. Returns an error if the item
// doesn't exist.
func (g *orderedIDs) Remove(id string) (ider, error) {
if len(id) == 0 {
Expand Down Expand Up @@ -147,7 +147,7 @@ func newRelativeOrder() *relativeOrder {
}
}

// Add inserts a item into the order relative to the position provided.
// Add inserts an item into the order relative to the position provided.
func (s *relativeOrder) Add(pos RelativePosition, ids ...string) error {
if len(ids) == 0 {
return nil
Expand All @@ -173,7 +173,7 @@ func (s *relativeOrder) Add(pos RelativePosition, ids ...string) error {
return nil
}

// Insert injects a item before or after the relative item. Returns
// Insert injects an item before or after the relative item. Returns
// an error if the relative item does not exist.
func (s *relativeOrder) Insert(relativeTo string, pos RelativePosition, ids ...string) error {
if len(ids) == 0 {
Expand All @@ -195,7 +195,7 @@ func (s *relativeOrder) Insert(relativeTo string, pos RelativePosition, ids ...s
}

// Swap will replace the item id with the to item. Returns an
// error if the original item id does not exist. Allows swapping out a
// error if the original item id does not exist. Allows swapping out an
// item for another item with the same id.
func (s *relativeOrder) Swap(id, to string) error {
i, ok := s.has(id)
Expand Down
Loading

0 comments on commit 9ca8ee0

Please sign in to comment.