Skip to content

Instantly share code, notes, and snippets.

@danrl
Created March 26, 2018 08:06
Show Gist options
  • Save danrl/9581c1ff56b0c8f57be170fed0e55635 to your computer and use it in GitHub Desktop.
Save danrl/9581c1ff56b0c8f57be170fed0e55635 to your computer and use it in GitHub Desktop.
func main() {
// read metadata
metadataChan := make(chan *line)
go reader("metadata.csv", metadataChan)
// read strength set IDs
strengthSetChan := make(chan *line)
go reader("strength_sets.csv", strengthSetChan)
// join the two data streams
augmentedLinesChan := make(chan *line)
go joiner(metadataChan, strengthSetChan, augmentedLinesChan)
// write computed lines
fmt.Println("id,user_id,machine_id,circle_id,timestamp,strength_set_ids")
for l := range augmentedLinesChan {
fmt.Printf("%v,%v\n", l.id, l.restOfLine)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment