-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
54 lines (44 loc) · 873 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
//"encoding/json"
"fmt"
//"io"
"log"
"runtime"
//"strings"
"sync"
)
var wg sync.WaitGroup
func main() {
runtime.GOMAXPROCS(2)
fmt.Println("Starting Go Routines")
//parse CSV and read lines
properties, lines, err := readCSV("./data1.csv")
if err != nil {
log.Fatalf("Error: %v", err)
}
//Loop through lines in CSV file and construct json objects with the data
for i, line := range lines {
if i == 0 {
continue //skip first line
}
wg.Add(1)
convert(properties, line)
}
fmt.Println("Waiting To Finish")
wg.Wait()
//just testing
/*for _, i := range json_objs {
dec := json.NewDecoder(strings.NewReader(i))
for {
var m CSVRow
if err := dec.Decode(&m); err == io.EOF {
break
} else if err != nil {
log.Fatal("err")
}
fmt.Println("\n", m)
}
}*/
fmt.Println("\nTerminating Program")
}