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>
pull/9584/head^2
Joshua Hesketh 3 years ago committed by GitHub
parent 8a9f519d82
commit 033b504aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      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())
}

Loading…
Cancel
Save