type_encode.go: Add redundancy comments

for/master
Dustin Oprea 2020-01-01 23:58:06 -05:00
parent 3a4fc51e30
commit 1ae6e31ca9
1 changed files with 8 additions and 2 deletions

View File

@ -15,8 +15,10 @@ var (
// EncodedData encapsulates the compound output of an encoding operation.
type EncodedData struct {
Type TagTypePrimitive
Encoded []byte
Type TagTypePrimitive
Encoded []byte
// TODO(dustin): Is this really necessary? We might have this just to correlate to the incoming stream format (raw bytes and a unit-count both for incoming and outgoing).
UnitCount uint32
}
@ -185,6 +187,8 @@ func (ve *ValueEncoder) Encode(value interface{}) (ed EncodedData, err error) {
}
}()
// TODO(dustin): This is redundant with EncodeWithType. Refactor one to use the other.
switch value.(type) {
case []byte:
ed, err = ve.encodeBytes(value.([]byte))
@ -223,6 +227,8 @@ func (ve *ValueEncoder) EncodeWithType(tt TagType, value interface{}) (ed Encode
}
}()
// TODO(dustin): This is redundant with Encode. Refactor one to use the other.
switch tt.Type() {
case TypeByte:
ed, err = ve.encodeBytes(value.([]byte))