Skip to content

Commit

Permalink
fix unmarshalling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chrboe committed Sep 23, 2021
1 parent 47e221e commit f346624
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ bitbucket.org/creachadair/shell v0.0.6 h1:reJflDbKqnlnqb4Oo2pQ1/BqmY/eCWcNGHrIUO
bitbucket.org/creachadair/shell v0.0.6/go.mod h1:8Qqi/cYk7vPnsOePHroKXDJYmb5x7ENhtiFtfZq8K+M=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/LINBIT/golinstor v0.35.0 h1:EzazRrI6i6xdXVrlxQOus7GAN/v/B6FFwlclzqxySXQ=
github.com/LINBIT/golinstor v0.35.0/go.mod h1:506Wb/BCd449g/u2IGXlsIKNdiEmAEsgyOPrIYjbKyg=
github.com/LINBIT/golinstor v0.36.0 h1:+kY3IIRQngq6Tr3zYH97yA4KqiiM9p3yk6UpHiY8d0k=
github.com/LINBIT/golinstor v0.36.0/go.mod h1:506Wb/BCd449g/u2IGXlsIKNdiEmAEsgyOPrIYjbKyg=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (s *IpCidr) Set(raw string) error {
return nil
}

func (s *IpCidr) MarshalJSON() ([]byte, error) {
func (s IpCidr) MarshalJSON() ([]byte, error) {
return json.Marshal(s.IPNet.String())
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/common/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ func (l *ResourceState) UnmarshalJSON(text []byte) error {
*l = ResourceStateDegraded
case "Bad":
*l = ResourceStateBad
case "Unknown":
*l = Unknown
default:
return errors.New(fmt.Sprintf("unknown resource state: %s", l))
return errors.New(fmt.Sprintf("unknown resource state: %s", string(text)))
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/iscsi/iqn.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ func (i *Iqn) UnmarshalJSON(b []byte) error {
return i.UnmarshalText([]byte(raw))
}

func (i *Iqn) MarshalText() ([]byte, error) {
func (i Iqn) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}

func (i *Iqn) MarshalJSON() ([]byte, error) {
func (i Iqn) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}

Expand Down

0 comments on commit f346624

Please sign in to comment.