From: bep Date: Mon, 19 Jan 2015 02:06:07 +0000 (+0100) Subject: Use an init() method to create the HugoInfo instance X-Git-Tag: v0.13~171 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c23dfd99dd3a719b03d735161082022abaafa208;p=brevno-suite%2Fhugo Use an init() method to create the HugoInfo instance See #570 --- diff --git a/hugolib/hugo.go b/hugolib/hugo.go index 3e4d0203..b90373b3 100644 --- a/hugolib/hugo.go +++ b/hugolib/hugo.go @@ -17,14 +17,11 @@ type HugoInfo struct { BuildDate string } -func getHugoInfo() *HugoInfo { - if hugoInfo == nil { - hugoInfo = &HugoInfo{ - Version: Version, - CommitHash: CommitHash, - BuildDate: BuildDate, - Generator: ``, - } +func init() { + hugoInfo = &HugoInfo{ + Version: Version, + CommitHash: CommitHash, + BuildDate: BuildDate, + Generator: ``, } - return hugoInfo } diff --git a/hugolib/node.go b/hugolib/node.go index 85cf6aeb..0c3ed9ce 100644 --- a/hugolib/node.go +++ b/hugolib/node.go @@ -78,7 +78,7 @@ func (n *Node) IsMenuCurrent(menuId string, inme *MenuEntry) bool { } func (n *Node) Hugo() *HugoInfo { - return getHugoInfo() + return hugoInfo } func (n *Node) isSameAsDescendantMenu(inme *MenuEntry, parent *MenuEntry) bool {