Skip to content

Commit

Permalink
remove additional whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulhannanali committed Apr 13, 2021
1 parent b8d342f commit e998a99
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
7 changes: 1 addition & 6 deletions query/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ type Encoder interface {
// values using Ruby format, and would lead to recursive serialization of all the nested struct
// fields and slice/array within that struct as well (This was added in PR # 48)
//
//
// Anonymous struct fields are usually encoded as if their inner exported
// fields were fields in the outer struct, subject to the standard Go
// visibility rules. An anonymous struct field with a name given in its URL
Expand All @@ -124,8 +123,6 @@ type Encoder interface {
//
// "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO"
//
//
//
// All other values are encoded using their default string representation.
//
// Multiple fields that encode to the same URL parameter name will be included
Expand Down Expand Up @@ -165,7 +162,6 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
var scopes map[*reflect.Value]string

typ := val.Type()

for i := 0; i < typ.NumField(); i++ {
sf := typ.Field(i)
if sf.PkgPath != "" && !sf.Anonymous { // unexported
Expand All @@ -177,7 +173,6 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
if tag == "-" {
continue
}

name, opts := parseTag(tag)

if name == "" {
Expand Down Expand Up @@ -346,7 +341,7 @@ func valueString(v reflect.Value, opts tagOptions, sf reflect.StructField) strin
}

// isEmptyValue checks if a value should be considered empty for the purposes
// of omit ting fields with the "omitempty" option.
// of omitting fields with the "omitempty" option.
func isEmptyValue(v reflect.Value) bool {
switch v.Kind() {
case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
Expand Down
10 changes: 0 additions & 10 deletions query/encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func TestValues_BasicTypes(t *testing.T) {
}{false},
url.Values{"V": {"0"}},
},

{
struct {
V bool `url:",int"`
Expand Down Expand Up @@ -134,9 +133,7 @@ func TestValues_Pointers(t *testing.T) {
}
}

// IMPORTANT
func TestValues_Slices(t *testing.T) {
// The base struct could be abstracted
tests := []struct {
input interface{}
want url.Values
Expand All @@ -146,7 +143,6 @@ func TestValues_Slices(t *testing.T) {
struct{ V []string }{},
url.Values{},
},

{
struct{ V []string }{[]string{"a", "b"}},
url.Values{"V": {"a", "b"}},
Expand Down Expand Up @@ -465,25 +461,20 @@ func TestValues_EmbeddedStructs(t *testing.T) {
type Inner struct {
V string
}

type Outer struct {
Inner
}

type OuterPtr struct {
*Inner
}

type Mixed struct {
Inner
V string
}

type unexported struct {
Inner
V string
}

type Exported struct {
unexported
}
Expand All @@ -503,7 +494,6 @@ func TestValues_EmbeddedStructs(t *testing.T) {
{
// This step would happen before anything else, so we need not worry about it
Mixed{Inner: Inner{V: "a"}, V: "b"},

url.Values{"V": {"b", "a"}},
},
{
Expand Down

0 comments on commit e998a99

Please sign in to comment.