diff options
author | bep <bjorn.erik.pedersen@gmail.com> | 2015-01-19 03:06:07 +0100 |
---|---|---|
committer | bep <bjorn.erik.pedersen@gmail.com> | 2015-01-19 03:06:07 +0100 |
commit | c23dfd99dd3a719b03d735161082022abaafa208 (patch) | |
tree | 30a0ca80459a1b3978bf11a2f132e7c547d7a774 /hugolib | |
parent | 7257ab6855df7c5c0a1614daee39bdc684ae8056 (diff) |
Use an init() method to create the HugoInfo instance
See #570
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/hugo.go | 15 | ||||
-rw-r--r-- | hugolib/node.go | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/hugolib/hugo.go b/hugolib/hugo.go index 3e4d02039..b90373b3c 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: `<meta name="generator" content="Hugo ` + Version + `" />`, - } +func init() { + hugoInfo = &HugoInfo{ + Version: Version, + CommitHash: CommitHash, + BuildDate: BuildDate, + Generator: `<meta name="generator" content="Hugo ` + Version + `" />`, } - return hugoInfo } diff --git a/hugolib/node.go b/hugolib/node.go index 85cf6aeb6..0c3ed9ce6 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 { |