summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go34
1 files changed, 31 insertions, 3 deletions
diff --git a/main.go b/main.go
index f47ffef..cd19454 100644
--- a/main.go
+++ b/main.go
@@ -1,12 +1,40 @@
package main
import (
+ "bufio"
"log"
+ "os"
+ "strings"
)
func main() {
- err := cleanData()
- if err != nil {
- log.Println(err)
+
+ stdin := readFromStdin()
+ for line := range stdin {
+ strs := strings.Split(line, ",")
+ for _, str := range strs {
+ log.Println(str)
+ }
}
+ /*
+ err := cleanData()
+ if err != nil {
+ log.Println(err)
+ }
+ */
+}
+
+//Starts a process that reads from stdin and
+//puts the strings read on the returned channel
+func readFromStdin() <-chan string {
+
+ out := make(chan string)
+ go func() {
+ scanner := bufio.NewScanner(os.Stdin)
+ for scanner.Scan() {
+ out <- scanner.Text()
+ }
+ close(out)
+ }()
+ return out
}