From eadf37ad7ab0c25764f22923bae60ef70daea75f Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 16 Feb 2017 15:53:04 -0500 Subject: Added NewPostList constructor to set fields to be non-null (#5440) --- model/post_list.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'model/post_list.go') diff --git a/model/post_list.go b/model/post_list.go index 2de4df7d8..9b56f0233 100644 --- a/model/post_list.go +++ b/model/post_list.go @@ -13,6 +13,13 @@ type PostList struct { Posts map[string]*Post `json:"posts"` } +func NewPostList() *PostList { + return &PostList{ + Order: make([]string, 0), + Posts: make(map[string]*Post), + } +} + func (o *PostList) ToJson() string { b, err := json.Marshal(o) if err != nil { -- cgit v1.2.3-1-g7c22