Moved RegisterType to marshalVal
This commit is contained in:
parent
35eae62602
commit
0f4b7ad08e
|
@ -4,8 +4,6 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"gitea.olznet.de/OlzNet/slog"
|
||||
)
|
||||
|
||||
type Encoder struct {
|
||||
|
@ -24,12 +22,6 @@ func (enc *Encoder) Encode(e interface{}) (err error) {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = RegisterType(v.Interface()); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, t := range cacheTypes.ntypes {
|
||||
slog.LOG_DEBUGFLN("t: %v", t)
|
||||
}
|
||||
|
||||
var b []byte
|
||||
if b, err = marshalVal(v.Interface()); err != nil {
|
||||
|
|
|
@ -371,6 +371,10 @@ func marshalType(e interface{}, ntype *NType) (ret []byte, err error) {
|
|||
}
|
||||
|
||||
func marshalVal(e interface{}) (ret []byte, err error) {
|
||||
if err = RegisterType(e); err != nil {
|
||||
return ret, err
|
||||
}
|
||||
|
||||
i, n, nl, err := indirectType(e)
|
||||
if err != nil {
|
||||
return ret, ErrValueInvalid
|
||||
|
|
Loading…
Reference in New Issue