Skip to content

Commit

Permalink
temporary disable struct encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg committed Jan 27, 2021
1 parent 34001fd commit a0ca409
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"io"
"math"
"reflect"
"sort"
"strconv"
)

Expand Down Expand Up @@ -236,33 +235,6 @@ func (e *Encoder) marshalMap(val reflect.Value) error {
}

func (e *Encoder) marshalStruct(val reflect.Value) error {
if val.NumField() == 0 {
e.buf.WriteString("de")
return nil
}

valType := val.Type()
keys := positionedFieldsByName{}

for i := 0; i < val.NumField(); i++ {
fieldOpt := extractFieldOptions(val, valType.Field(i).Name)
if len(fieldOpt) == 0 {
continue
}
keys = append(keys, positionedField{fieldOpt, i})
}
sort.Sort(keys)

e.buf.WriteByte('d')
for _, key := range keys {
e.marshalString(key.name)

value := val.Field(key.pos)
if err := e.marshal(value.Interface()); err != nil {
return err
}
}
e.buf.WriteByte('e')
return nil
}

Expand Down

0 comments on commit a0ca409

Please sign in to comment.