From 49a24e4b3eb757ba2fe0bce4356c6b80af0832bc Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 8 Nov 2021 15:25:13 +0300 Subject: [PATCH] [#53] session: refactor missed `Marshal` declarations Signed-off-by: Evgenii Stratonikov --- session/container.go | 8 ++------ session/session.go | 12 ++---------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/session/container.go b/session/container.go index cb2f86bd..ec824857 100644 --- a/session/container.go +++ b/session/container.go @@ -115,12 +115,8 @@ func (x *ContainerContext) IsForSetEACL() bool { } // Marshal marshals ContainerContext into a protobuf binary form. -func (x *ContainerContext) Marshal(bs ...[]byte) ([]byte, error) { - var buf []byte - if len(bs) > 0 { - buf = bs[0] - } - return x.ToV2().StableMarshal(buf) +func (x *ContainerContext) Marshal() ([]byte, error) { + return x.ToV2().StableMarshal(nil) } // Unmarshal unmarshals protobuf binary representation of ContainerContext. diff --git a/session/session.go b/session/session.go index 623586d9..c38e0d76 100644 --- a/session/session.go +++ b/session/session.go @@ -250,17 +250,9 @@ func GetContainerContext(t *Token) *ContainerContext { } // Marshal marshals Token into a protobuf binary form. -// -// Buffer is allocated when the argument is empty. -// Otherwise, the first buffer is used. -func (t *Token) Marshal(bs ...[]byte) ([]byte, error) { - var buf []byte - if len(bs) > 0 { - buf = bs[0] - } - +func (t *Token) Marshal() ([]byte, error) { return (*session.SessionToken)(t). - StableMarshal(buf) + StableMarshal(nil) } // Unmarshal unmarshals protobuf binary representation of Token.