prysmaticlabs / prysm

Usage of both value and pointer receivers GO-W1029
Anti-pattern
Major
2 hours agoa year old
Type "Gwei" has both value and pointer receivers
57}
58
59// SizeSSZ --
60func (g *Gwei) SizeSSZ() int {61	return 8
62}
63
Type "Gwei" has both value and pointer receivers
51}
52
53// MarshalSSZ --
54func (g *Gwei) MarshalSSZ() ([]byte, error) {55	marshalled := fssz.MarshalUint64([]byte{}, uint64(*g))
56	return marshalled, nil
57}
Type "Gwei" has both value and pointer receivers
42}
43
44// MarshalSSZTo --
45func (g *Gwei) MarshalSSZTo(dst []byte) ([]byte, error) {46	marshalled, err := g.MarshalSSZ()
47	if err != nil {
48		return nil, err
Type "Gwei" has both value and pointer receivers
33}
34
35// UnmarshalSSZ --
36func (g *Gwei) UnmarshalSSZ(buf []byte) error {37	if len(buf) != g.SizeSSZ() {
38		return fmt.Errorf("expected buffer of length %d received %d", g.SizeSSZ(), len(buf))
39	}
Type "Gwei" has both value and pointer receivers
27}
28
29// HashTreeRootWith --
30func (g Gwei) HashTreeRootWith(hh *fssz.Hasher) error {31	hh.PutUint64(uint64(g))
32	return nil
33}