diff options
author | Pacien | 2013-07-01 15:46:54 +0200 |
---|---|---|
committer | Pacien | 2013-07-01 15:46:54 +0200 |
commit | f4ea5b63f3539de1e2f08257db43cb2002ec65d0 (patch) | |
tree | 11f8aef2dc25e68f8ae9063391a132cb3c5777a1 /common.go | |
parent | c879511377bdb76615b58b212f030e82fb88d3be (diff) | |
download | foldaweb-f4ea5b63f3539de1e2f08257db43cb2002ec65d0.tar.gz |
Fix go routines sync delays
Diffstat (limited to 'common.go')
-rw-r--r-- | common.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -84,7 +84,6 @@ func parse(dirPath string, elements map[string][]byte, exts []string, overwrite | |||
84 | } | 84 | } |
85 | 85 | ||
86 | func compile(dirPath string, elements map[string][]byte, sourceDir, outputDir, saveAs string, exts []string, recursive bool) { | 86 | func compile(dirPath string, elements map[string][]byte, sourceDir, outputDir, saveAs string, exts []string, recursive bool) { |
87 | wait.Add(1) | ||
88 | defer wait.Done() | 87 | defer wait.Done() |
89 | 88 | ||
90 | if strings.HasPrefix(dirPath, outputDir) { | 89 | if strings.HasPrefix(dirPath, outputDir) { |
@@ -96,6 +95,7 @@ func compile(dirPath string, elements map[string][]byte, sourceDir, outputDir, s | |||
96 | if recursive { | 95 | if recursive { |
97 | dirs, _ := fcmd.Ls(dirPath) | 96 | dirs, _ := fcmd.Ls(dirPath) |
98 | for _, dir := range dirs { | 97 | for _, dir := range dirs { |
98 | wait.Add(1) | ||
99 | go compile(path.Join(dirPath, dir), elements, sourceDir, outputDir, saveAs, exts, recursive) | 99 | go compile(path.Join(dirPath, dir), elements, sourceDir, outputDir, saveAs, exts, recursive) |
100 | } | 100 | } |
101 | } | 101 | } |
@@ -111,7 +111,6 @@ func compile(dirPath string, elements map[string][]byte, sourceDir, outputDir, s | |||
111 | } | 111 | } |
112 | 112 | ||
113 | func copyFiles(dirPath, sourceDir, outputDir string, exts []string, recursive bool) { | 113 | func copyFiles(dirPath, sourceDir, outputDir string, exts []string, recursive bool) { |
114 | wait.Add(1) | ||
115 | defer wait.Done() | 114 | defer wait.Done() |
116 | 115 | ||
117 | if strings.HasPrefix(dirPath, outputDir) { | 116 | if strings.HasPrefix(dirPath, outputDir) { |
@@ -130,6 +129,7 @@ func copyFiles(dirPath, sourceDir, outputDir string, exts []string, recursive bo | |||
130 | 129 | ||
131 | if recursive { | 130 | if recursive { |
132 | for _, dir := range dirs { | 131 | for _, dir := range dirs { |
132 | wait.Add(1) | ||
133 | go copyFiles(path.Join(dirPath, dir), sourceDir, outputDir, exts, recursive) | 133 | go copyFiles(path.Join(dirPath, dir), sourceDir, outputDir, exts, recursive) |
134 | } | 134 | } |
135 | } | 135 | } |