diff options
Diffstat (limited to 'model/security_bulletin.go')
-rw-r--r-- | model/security_bulletin.go | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/model/security_bulletin.go b/model/security_bulletin.go index b8c1dc48d..958b9c9e3 100644 --- a/model/security_bulletin.go +++ b/model/security_bulletin.go @@ -16,23 +16,14 @@ type SecurityBulletin struct { type SecurityBulletins []SecurityBulletin func (me *SecurityBulletin) ToJson() string { - b, err := json.Marshal(me) - if err != nil { - return "" - } else { - return string(b) - } + b, _ := json.Marshal(me) + return string(b) } func SecurityBulletinFromJson(data io.Reader) *SecurityBulletin { - decoder := json.NewDecoder(data) - var o SecurityBulletin - err := decoder.Decode(&o) - if err == nil { - return &o - } else { - return nil - } + var o *SecurityBulletin + json.NewDecoder(data).Decode(&o) + return o } func (me SecurityBulletins) ToJson() string { @@ -44,12 +35,7 @@ func (me SecurityBulletins) ToJson() string { } func SecurityBulletinsFromJson(data io.Reader) SecurityBulletins { - decoder := json.NewDecoder(data) var o SecurityBulletins - err := decoder.Decode(&o) - if err == nil { - return o - } else { - return nil - } + json.NewDecoder(data).Decode(&o) + return o } |