ugorji / go

idiomatic codec and rpc lib for msgpack, cbor, json, etc. msgpack.org[Go]
MIT License
1.87k stars 295 forks source link

How can I use codecgen for slices #68

Closed fgrzadkowski closed 9 years ago

fgrzadkowski commented 9 years ago

I have a struct that have a slice:

type Test struct {
  Tests Tests
}

type Tests []*Test

I get the following error after generating code:

./values.generated.go:66: x.Tests.CodecEncodeSelf undefined (type Tests has no field or method CodecEncodeSelf)
./values.generated.go:76: x.Tests.CodecEncodeSelf undefined (type Tests has no field or method CodecEncodeSelf)
./values.generated.go:143: yyv5.CodecDecodeSelf undefined (type *Tests has no field or method CodecDecodeSelf)
./values.generated.go:175: yyv7.CodecDecodeSelf undefined (type *Tests has no field or method CodecDecodeSelf)
./values.generated.go:195: invalid receiver type []*Test ([]*Test is an unnamed type)
./values.generated.go:206: invalid receiver type *[]*Test ([]*Test is an unnamed type)
ugorji commented 9 years ago

I see the problem. We didn't use the Type name appropriately.

Let me work on a fix soon.

ugorji commented 9 years ago

Regression. Incomplete fix. Should use fully qualified name.

ugorji commented 9 years ago

Fix from 5473e5622030a33d356d78ff6ac65fe88547a3ee