I basically collect data through a scraper, and then want to process that data in two ways: either reject or accept. For not to slow down the scraper I pass the data either to a reject channel or accept channel. I need these channels to simultaneously listen for data in respective channel. This is my attempt so far:
func main() {
okChannel := make(chan Article)
rejectChannel := make(chan Article)
scrape := new(scrapers)
go Init(okChannel, rejectChannel)
go func(okChannel chan Article) {
for article := range okChannel {
SaveArticle(article)
fmt.Printf("SAVED")
}
}(okChannel)
go func(rejectChannel chan Article) {
for article := range rejectChannel {
RejectArticle(article)
fmt.Printf("REJECTED")
}
}(rejectChannel)
Please help