@@ -15,7 +15,6 @@ import (
1515 "sync"
1616)
1717
18- var tempDir , _ = ioutil .TempDir ("" , "pdoop" )
1918var parallel = flag .Int ("p" , 10 , "parallel" )
2019var mergeMode = flag .Bool ("m" , false , "merge as a single file" )
2120
@@ -108,8 +107,9 @@ func checkDir(path string) error {
108107
109108func doMergeMode (hdfs HDFS , ch chan string , fileGroups [][]string , output string ) {
110109 var wg sync.WaitGroup
111- log . Println ( "tempDir: " , tempDir )
110+ var tempDir , _ = ioutil . TempDir ( " " , "pdoop" )
112111 defer os .RemoveAll (tempDir )
112+ log .Println ("tempDir: " , tempDir )
113113 for _ , files := range fileGroups {
114114 wg .Add (1 )
115115 go func (files []string ) {
@@ -124,7 +124,7 @@ func doMergeMode(hdfs HDFS, ch chan string, fileGroups [][]string, output string
124124 mergeFiles (ch , output )
125125}
126126
127- // merge as a single files
127+ // merge files from channel as a single files
128128func mergeFiles (ch chan string , output string ) {
129129 out , err := os .Create (output )
130130 if err != nil {
@@ -182,7 +182,6 @@ func main() {
182182 err := checkDir (output )
183183 if err != nil {
184184 log .Fatal (err )
185- os .Exit (1 )
186185 }
187186 }
188187 hdfs := NewHDFS ()
0 commit comments