Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run golint and go vet #539

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion document/cbor/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (d *decoder) Decode(v cbor.Value, to interface{}) error {

rv := reflect.ValueOf(to)
if rv.Kind() != reflect.Ptr || rv.IsNil() || !rv.IsValid() {
return &document.InvalidUnmarshalError{reflect.TypeOf(to)}
return &document.InvalidUnmarshalError{Type: reflect.TypeOf(to)}
}

return d.decode(v, rv, serde.Tag{})
Expand Down
2 changes: 1 addition & 1 deletion document/cbor/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (e *encoder) encodeMap(rv reflect.Value) (cbor.Map, error) {
for _, key := range rv.MapKeys() {
keyName := fmt.Sprint(key.Interface())
if keyName == "" {
return nil, &document.InvalidMarshalError{"map key cannot be empty"}
return nil, &document.InvalidMarshalError{Message: "map key cannot be empty"}
}

cv, err := e.encode(rv.MapIndex(key), serde.Tag{})
Expand Down
4 changes: 2 additions & 2 deletions encoding/cbor/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (v EncodeRaw) encode(p []byte) int {
return len(v)
}

// FixedUint encodes fixed-width Uint values.
// EncodeFixedUint encodes fixed-width Uint values.
//
// This is used by the encoder for the purpose of embedding integrals in
// document shapes. Decode will never return values of this type.
Expand All @@ -203,7 +203,7 @@ func (v EncodeFixedUint) encode(p []byte) int {
return 9
}

// FixedUint encodes fixed-width NegInt values.
// EncodeFixedNegInt encodes fixed-width NegInt values.
//
// This is used by the encoder for the purpose of embedding integrals in
// document shapes. Decode will never return values of this type.
Expand Down
1 change: 0 additions & 1 deletion encoding/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Package encoding provides utilities for encoding values for specific
// document encodings.

package encoding
2 changes: 1 addition & 1 deletion encoding/httpbinding/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NewEncoder(path, query string, headers http.Header) (*Encoder, error) {
return NewEncoderWithRawPath(path, path, query, headers)
}

// NewHTTPBindingEncoder creates a new encoder from the passed in request. All query and
// NewEncoderWithRawPath creates a new encoder from the passed in request. All query and
// header values will be added on top of the request's existing values. Overwriting
// duplicate values.
func NewEncoderWithRawPath(path, rawPath, query string, headers http.Header) (*Encoder, error) {
Expand Down
1 change: 0 additions & 1 deletion endpoints/private/rulesfn/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Package rulesfn provides endpoint rule functions for evaluating endpoint
// resolution rules.

package rulesfn
2 changes: 1 addition & 1 deletion endpoints/private/rulesfn/strings.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package rulesfn

// Substring returns the substring of the input provided. If the start or stop
// SubString returns the substring of the input provided. If the start or stop
// indexes are not valid for the input nil will be returned. If errors occur
// they will be added to the provided [ErrorCollector].
func SubString(input string, start, stop int, reverse bool) *string {
Expand Down
1 change: 0 additions & 1 deletion internal/sync/singleflight/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
// and unversioned golang.org/x/sync module.
//
// https://github.com/golang/sync/tree/67f06af15bc961c363a7260195bcd53487529a21/singleflight

package singleflight
8 changes: 4 additions & 4 deletions middleware/stack_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func ClearStackValues(ctx context.Context) context.Context {
return context.WithValue(ctx, stackValuesKey{}, nil)
}

// GetStackValues returns the value pointed to by the key within the stack
// GetStackValue returns the value pointed to by the key within the stack
// values, if it is present.
func GetStackValue(ctx context.Context, key interface{}) interface{} {
md, _ := ctx.Value(stackValuesKey{}).(*stackValues)
Expand Down Expand Up @@ -62,13 +62,13 @@ func (m *stackValues) Value(key interface{}) interface{} {
return m.parent.Value(key)
}

func (c *stackValues) String() string {
func (m *stackValues) String() string {
var str strings.Builder

cc := c
cc := m
for cc == nil {
str.WriteString("(" +
reflect.TypeOf(c.key).String() +
reflect.TypeOf(m.key).String() +
": " +
stringify(cc.value) +
")")
Expand Down
6 changes: 4 additions & 2 deletions private/requestcompression/request_compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import (
"bytes"
"context"
"fmt"
"io"

"github.com/aws/smithy-go/middleware"
"github.com/aws/smithy-go/transport/http"
"io"
)

const MaxRequestMinCompressSizeBytes = 10485760
// MaxRequestMinCompressSizeBytes is the maximum value allowed for the member MinCompressSizeBytes
const MaxRequestMinCompressSizeBytes = 10485760 // 10 MB

// Enumeration values for supported compress Algorithms.
const (
Expand Down
6 changes: 3 additions & 3 deletions testing/xml/doc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// package xml is xml testing package that supports xml comparison utility.
// Package xml is xml testing package that supports xml comparison utility.
// The package consists of XMLToStruct and StructToXML utils that help sort xml elements
// as per their nesting level. XMLToStruct function converts an xml document into a sorted
// as per their nesting level. XMLToStruct function converts a xml document into a sorted
// tree node structure, while StructToXML converts the sorted xml nodes into a sorted xml document.
// SortXML function should be used to sort an xml document. It can be configured to ignore indentation
// SortXML function should be used to sort a xml document. It can be configured to ignore indentation
package xml
4 changes: 2 additions & 2 deletions testing/xml/xmlToStruct.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
)

// A XMLNode contains the values to be encoded or decoded.
// XMLNode contains the values to be encoded or decoded.
type XMLNode struct {
Name xml.Name `json:",omitempty"`
Children map[string][]*XMLNode `json:",omitempty"`
Expand Down Expand Up @@ -159,7 +159,7 @@ func StructToXML(e *xml.Encoder, node *XMLNode, sorted bool) error {
sort.Strings(sortedNames)

for _, k := range sortedNames {
// we should sort the []*xml.Node for each key if len >1
// we should sort the []*xml.XMLNode for each key if len >1
flattenedNodes := node.Children[k]
// Meaning this has multiple nodes
if len(flattenedNodes) > 1 {
Expand Down
2 changes: 1 addition & 1 deletion transport/http/headerlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func quotedCommaSplit(v string) (parts []string, err error) {
//------------------------------
var j int
var skipQuote bool
for j += 1; j < len(remaining); j++ {
for j ++; j < len(remaining); j++ {
if remaining[j] == '\\' || (remaining[j] != '\\' && skipQuote) {
skipQuote = !skipQuote
continue
Expand Down
2 changes: 1 addition & 1 deletion transport/http/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func SetSigV4ASigningName(p *smithy.Properties, name string) {
p.Set(sigV4ASigningNameKey{}, name)
}

// GetSigV4ASigningRegion gets the v4a signing region set from Properties.
// GetSigV4ASigningRegions gets the v4a signing region set from Properties.
func GetSigV4ASigningRegions(p *smithy.Properties) ([]string, bool) {
v, ok := p.Get(sigV4ASigningRegionsKey{}).([]string)
return v, ok
Expand Down
Loading