Added NewPostList constructor to set fields to be non-null (#5440)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
38c42ca53f
Коммит
eadf37ad7a
@@ -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 {
|
||||
|
||||
Ссылка в новой задаче
Block a user