From 0595f27e6d442ca851e3cf065a95f5e3471c6be6 Mon Sep 17 00:00:00 2001 From: Noah Campbell Date: Sat, 3 Aug 2013 10:52:40 -0700 Subject: [PATCH] Using a composite literal to create a page. Wonder why the need for composite structs. Not sure if my go knowledge is lacking or if this is cruft from other programming language doctrine. --- hugolib/page.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hugolib/page.go b/hugolib/page.go index 05e40d981..3ec2b9005 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -77,14 +77,13 @@ func (p Pages) Sort() { sort.Sort(p) } func (p Pages) Limit(n int) Pages { return p[0:n] } func initializePage(filename string) (page Page) { - page = Page{} + page = Page{contentType: "", + File: File{FileName: filename, + Extension: "html"}, + Params: make(map[string]interface{}), + Node: Node{Keywords: make([]string, 10, 30)}, + Markup: "md"} page.Date, _ = time.Parse("20060102", "20080101") - page.FileName = filename - page.contentType = "" - page.Extension = "html" - page.Params = make(map[string]interface{}) - page.Keywords = make([]string, 10, 30) - page.Markup = "md" page.setSection() return page