From 033b504aa70efe7abdebcce9e376ab6c0c12e7cf Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Thu, 1 Jun 2023 00:44:42 +1000 Subject: [PATCH] Fix marshalling ByteSize (#9570) When marshalling to yaml or json, expect the value not a pointer. Co-authored-by: Michel Hollands <42814411+MichelHollands@users.noreply.github.com> --- pkg/util/flagext/bytesize.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/util/flagext/bytesize.go b/pkg/util/flagext/bytesize.go index d13612729c..e17d3609d0 100644 --- a/pkg/util/flagext/bytesize.go +++ b/pkg/util/flagext/bytesize.go @@ -48,7 +48,7 @@ func (bs *ByteSize) UnmarshalYAML(unmarshal func(interface{}) error) error { // MarshalYAML implements yaml.Marshaller. // Use a string representation for consistency -func (bs *ByteSize) MarshalYAML() (interface{}, error) { +func (bs ByteSize) MarshalYAML() (interface{}, error) { return bs.String(), nil } @@ -64,6 +64,6 @@ func (bs *ByteSize) UnmarshalJSON(val []byte) error { } // Use a string representation for consistency -func (bs *ByteSize) MarshalJSON() ([]byte, error) { +func (bs ByteSize) MarshalJSON() ([]byte, error) { return json.Marshal(bs.String()) }