From 9d8e274d6f413c4e6f6048ccfa15d96835036e26 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 13 Apr 2018 16:54:47 +0900 Subject: [PATCH] ing --- subscribe/message.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subscribe/message.go b/subscribe/message.go index 86f1d10..5d1a346 100644 --- a/subscribe/message.go +++ b/subscribe/message.go @@ -44,15 +44,15 @@ func (st TargetType) String() string { return targetTypeID[st] } -func (st TargetType) MarshalJSON() ([]byte, error) { - value, ok := targetTypeID[st] +func (st *TargetType) MarshalJSON() ([]byte, error) { + value, ok := targetTypeID[*st] if !ok { return nil, fmt.Errorf("Invalid EnumType[%s] value", st) } return json.Marshal(value) } -func (st TargetType) UnmarshalJSON(b []byte) error { +func (st *TargetType) UnmarshalJSON(b []byte) error { // unmarshal as string var s string err := json.Unmarshal(b, &s) @@ -64,6 +64,6 @@ func (st TargetType) UnmarshalJSON(b []byte) error { if !ok { return fmt.Errorf("Invalid EnumType[%s] value", s) } - st = value + st = &value return nil }