Use an init() method to create the HugoInfo instance

See #570
This commit is contained in:
bep 2015-01-19 03:06:07 +01:00
parent 7257ab6855
commit c23dfd99dd
2 changed files with 7 additions and 10 deletions

View file

@ -17,8 +17,7 @@ type HugoInfo struct {
BuildDate string BuildDate string
} }
func getHugoInfo() *HugoInfo { func init() {
if hugoInfo == nil {
hugoInfo = &HugoInfo{ hugoInfo = &HugoInfo{
Version: Version, Version: Version,
CommitHash: CommitHash, CommitHash: CommitHash,
@ -26,5 +25,3 @@ func getHugoInfo() *HugoInfo {
Generator: `<meta name="generator" content="Hugo ` + Version + `" />`, Generator: `<meta name="generator" content="Hugo ` + Version + `" />`,
} }
} }
return hugoInfo
}

View file

@ -78,7 +78,7 @@ func (n *Node) IsMenuCurrent(menuId string, inme *MenuEntry) bool {
} }
func (n *Node) Hugo() *HugoInfo { func (n *Node) Hugo() *HugoInfo {
return getHugoInfo() return hugoInfo
} }
func (n *Node) isSameAsDescendantMenu(inme *MenuEntry, parent *MenuEntry) bool { func (n *Node) isSameAsDescendantMenu(inme *MenuEntry, parent *MenuEntry) bool {