Votes from Twitter
In your $GOPATH/src
folder, alongside other projects, create a new folder called socialpoll
for this chapter. This folder won't be a Go package or program by itself, but will contain our three component programs. Inside socialpoll
, create a new folder called twittervotes
and add the obligatory main.go
template (this is important as main
packages without a main
function won't compile):
package main func main(){}
Our twittervotes
program is going to:
- Load all polls from the MongoDB database using
mgo
, and collect all options from theoptions
array in each document - Open and maintain a connection to Twitter's streaming APIs looking for any mention of the options
- For each tweet that matches the filter, figure out which option is mentioned ...
Get Go Programming Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.