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,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
}

View file

@ -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 {