From 6706f747d4fa6504a98ed0456f072ad7d67648ad Mon Sep 17 00:00:00 2001 From: gagliardetto Date: Mon, 4 Apr 2022 14:01:23 +0200 Subject: [PATCH] `MarshalWithEncoder` method always of value --- message.go | 2 +- programs/associated-token-account/instructions.go | 2 +- programs/serum/instruction.go | 2 +- programs/serum/queue.go | 4 ++-- programs/serum/types.go | 2 +- programs/system/instructions.go | 2 +- programs/token/instructions.go | 2 +- programs/tokenregistry/instruction.go | 2 +- transaction.go | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/message.go b/message.go index 2466dd33..638b6f5b 100644 --- a/message.go +++ b/message.go @@ -94,7 +94,7 @@ func (mx *Message) MarshalBinary() ([]byte, error) { return buf, nil } -func (mx *Message) MarshalWithEncoder(encoder *bin.Encoder) error { +func (mx Message) MarshalWithEncoder(encoder *bin.Encoder) error { out, err := mx.MarshalBinary() if err != nil { return err diff --git a/programs/associated-token-account/instructions.go b/programs/associated-token-account/instructions.go index fc1bf392..b0ac3140 100644 --- a/programs/associated-token-account/instructions.go +++ b/programs/associated-token-account/instructions.go @@ -78,7 +78,7 @@ func (inst *Instruction) UnmarshalWithDecoder(decoder *bin.Decoder) error { return inst.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionImplDef) } -func (inst *Instruction) MarshalWithEncoder(encoder *bin.Encoder) error { +func (inst Instruction) MarshalWithEncoder(encoder *bin.Encoder) error { return encoder.Encode(inst.Impl) } diff --git a/programs/serum/instruction.go b/programs/serum/instruction.go index c2cf1a5d..51f9cf7a 100644 --- a/programs/serum/instruction.go +++ b/programs/serum/instruction.go @@ -93,7 +93,7 @@ func (i *Instruction) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) { return i.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionDefVariant) } -func (i *Instruction) MarshalWithEncoder(encoder *bin.Encoder) error { +func (i Instruction) MarshalWithEncoder(encoder *bin.Encoder) error { err := encoder.WriteUint8(i.Version) if err != nil { return fmt.Errorf("unable to write instruction version: %w", err) diff --git a/programs/serum/queue.go b/programs/serum/queue.go index a34c75bf..4a24d2c1 100644 --- a/programs/serum/queue.go +++ b/programs/serum/queue.go @@ -86,7 +86,7 @@ func (q *RequestQueue) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) { } // TODO: fill up later -func (q *RequestQueue) MarshalWithEncoder(encoder *bin.Encoder) error { +func (q RequestQueue) MarshalWithEncoder(encoder *bin.Encoder) error { return nil } @@ -241,7 +241,7 @@ func (q *EventQueue) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) { } // TODO: fill up later -func (q *EventQueue) MarshalWithEncoder(encoder *bin.Encoder) error { +func (q EventQueue) MarshalWithEncoder(encoder *bin.Encoder) error { return nil } diff --git a/programs/serum/types.go b/programs/serum/types.go index 09b23e36..bed3956a 100644 --- a/programs/serum/types.go +++ b/programs/serum/types.go @@ -169,7 +169,7 @@ func (s *Slab) UnmarshalWithDecoder(decoder *bin.Decoder) error { return s.BaseVariant.UnmarshalBinaryVariant(decoder, SlabFactoryImplDef) } -func (s *Slab) MarshalWithEncoder(encoder *bin.Encoder) error { +func (s Slab) MarshalWithEncoder(encoder *bin.Encoder) error { err := encoder.WriteUint32(s.TypeID.Uint32(), binary.LittleEndian) if err != nil { return err diff --git a/programs/system/instructions.go b/programs/system/instructions.go index c0089d13..c6469257 100644 --- a/programs/system/instructions.go +++ b/programs/system/instructions.go @@ -190,7 +190,7 @@ func (inst *Instruction) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error return inst.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionImplDef) } -func (inst *Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error { +func (inst Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error { err := encoder.WriteUint32(inst.TypeID.Uint32(), binary.LittleEndian) if err != nil { return fmt.Errorf("unable to write variant type: %w", err) diff --git a/programs/token/instructions.go b/programs/token/instructions.go index 9053af6d..cda804b1 100644 --- a/programs/token/instructions.go +++ b/programs/token/instructions.go @@ -330,7 +330,7 @@ func (inst *Instruction) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error return inst.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionImplDef) } -func (inst *Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error { +func (inst Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error { err := encoder.WriteUint8(inst.TypeID.Uint8()) if err != nil { return fmt.Errorf("unable to write variant type: %w", err) diff --git a/programs/tokenregistry/instruction.go b/programs/tokenregistry/instruction.go index 3314c303..ca3135c6 100644 --- a/programs/tokenregistry/instruction.go +++ b/programs/tokenregistry/instruction.go @@ -114,7 +114,7 @@ func (i *Instruction) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) { return i.BaseVariant.UnmarshalBinaryVariant(decoder, InstructionDefVariant) } -func (i *Instruction) MarshalWithEncoder(encoder *bin.Encoder) error { +func (i Instruction) MarshalWithEncoder(encoder *bin.Encoder) error { err := encoder.WriteUint32(i.TypeID.Uint32(), binary.LittleEndian) if err != nil { return fmt.Errorf("unable to write variant type: %w", err) diff --git a/transaction.go b/transaction.go index 39f44c04..63e114d3 100644 --- a/transaction.go +++ b/transaction.go @@ -347,7 +347,7 @@ func (tx *Transaction) MarshalBinary() ([]byte, error) { return output, nil } -func (tx *Transaction) MarshalWithEncoder(encoder *bin.Encoder) error { +func (tx Transaction) MarshalWithEncoder(encoder *bin.Encoder) error { out, err := tx.MarshalBinary() if err != nil { return err