prysmaticlabs / prysm

Usage of both value and pointer receivers GO-W1029
Anti-pattern
Major
4 days agoa year old
Type "Gwei" has both value and pointer receivers
261}
262
263// SizeSSZ --
264func (g *Gwei) SizeSSZ() int {265	return 8
266}
267
Type "Gwei" has both value and pointer receivers
255}
256
257// MarshalSSZ --
258func (g *Gwei) MarshalSSZ() ([]byte, error) {259	marshalled := fssz.MarshalUint64([]byte{}, uint64(*g))
260	return marshalled, nil
261}
Type "Gwei" has both value and pointer receivers
246}
247
248// MarshalSSZTo --
249func (g *Gwei) MarshalSSZTo(dst []byte) ([]byte, error) {250	marshalled, err := g.MarshalSSZ()
251	if err != nil {
252		return nil, err
Type "Gwei" has both value and pointer receivers
237}
238
239// UnmarshalSSZ --
240func (g *Gwei) UnmarshalSSZ(buf []byte) error {241	if len(buf) != g.SizeSSZ() {
242		return fmt.Errorf("expected buffer of length %d received %d", g.SizeSSZ(), len(buf))
243	}
Type "Gwei" has both value and pointer receivers
231}
232
233// HashTreeRootWith --
234func (g Gwei) HashTreeRootWith(hh *fssz.Hasher) error {235	hh.PutUint64(uint64(g))
236	return nil
237}