hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit c23dfd99dd3a719b03d735161082022abaafa208
parent 7257ab6855df7c5c0a1614daee39bdc684ae8056
Author: bep <bjorn.erik.pedersen@gmail.com>
Date:   Mon, 19 Jan 2015 03:06:07 +0100

Use an init() method to create the HugoInfo instance

See #570

Diffstat:
Mhugolib/hugo.go | 15++++++---------
Mhugolib/node.go | 2+-
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git 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
@@ -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 {