hugo

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

git clone git://git.shimmy1996.com/hugo.git
commit 6205a16b6e4e0e7924aed291c1adab1d775c1cfe
parent 85c04ca2f3bf1aac9941953918ab1f1b69f1a29f
Author: spf13 <steve.francia@gmail.com>
Date:   Thu, 13 Mar 2014 20:34:47 +0100

Fixes #227 by properly scoping the variables within the go routine.

Diffstat:
Mhugolib/site.go | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/hugolib/site.go b/hugolib/site.go
@@ -411,15 +411,14 @@ func (s *Site) RenderPages() (err error) {
 
 func (s *Site) RenderIndexes() (err error) {
 	var wg sync.WaitGroup
-	for singular, plural := range s.Config.Indexes {
-		for key, oo := range s.Indexes[plural] {
+	for sing, pl := range s.Config.Indexes {
+		for key, oo := range s.Indexes[pl] {
 			wg.Add(1)
-
-			go func(k string, o WeightedPages) (err error) {
+			go func(k string, o WeightedPages, singular string, plural string) (err error) {
 				defer wg.Done()
+				base := plural + "/" + k
 				n := s.NewNode()
 				n.Title = strings.Title(k)
-				base := plural + "/" + k
 				s.setUrls(n, base)
 				n.Date = o[0].Page.Date
 				n.Data[singular] = o
@@ -439,7 +438,7 @@ func (s *Site) RenderIndexes() (err error) {
 					}
 				}
 				return
-			}(key, oo)
+			}(key, oo, sing, pl)
 		}
 	}
 	wg.Wait()