forked from cerc-io/plugeth
909dd4a109
* rlp/rlpgen: remove build tag This tag was supposed to prevent unstable output when types reference each other. Imagine there are two struct types A and B, where a reference to type B is in A. If I run rlpgen on type B first, and then on type A, the generator will see the B.EncodeRLP method and call it. However, if I run rlpgen on type A first, it will inline the encoding of B. The solution I chose for the initial release of rlpgen was to just ignore methods generated by rlpgen using a build tag. But there is a problem with this: if any code in the package calls EncodeRLP explicitly, the package can't be loaded without errors anymore in rlpgen, because the loader ignores it. Would be nice if there was a way to just make it ignore invalid functions during type checking (they're not necessary for rlpgen), but golang.org/x/tools/go/packages does not provide a way of ignoring them. Luckily, the types we use rlpgen with do not reference each other right now, so we can just remove the build tags for now.
21 lines
407 B
Go
21 lines
407 B
Go
// Code generated by rlpgen. DO NOT EDIT.
|
|
|
|
package types
|
|
|
|
import "github.com/ethereum/go-ethereum/rlp"
|
|
import "io"
|
|
|
|
func (obj *Log) EncodeRLP(_w io.Writer) error {
|
|
w := rlp.NewEncoderBuffer(_w)
|
|
_tmp0 := w.List()
|
|
w.WriteBytes(obj.Address[:])
|
|
_tmp1 := w.List()
|
|
for _, _tmp2 := range obj.Topics {
|
|
w.WriteBytes(_tmp2[:])
|
|
}
|
|
w.ListEnd(_tmp1)
|
|
w.WriteBytes(obj.Data)
|
|
w.ListEnd(_tmp0)
|
|
return w.Flush()
|
|
}
|