Search Gear #13 – Variable Scoping!

OK so what next?

Need to query ‘my’ twitter timeline every ‘so often’.

‘So often’ is defined by the number of tweets returned from the maximum of 200 as allowed by twitters API. The number of tweets returned defines the period that twitter is queried (not sure if these – every so often – episodes will be this flexible as it may be a cron is required on some server somewhere – maybe just a background process

The query saves each tweet in a file appending new tweets to the file every-time the query occurs. The file is named by date. New contents are appended, new query is based on the next 200 from the last tweet ID retrieved. All of this is saved to file and when a tweet date changes we start a new file based on the date change.

In the future we will extend this so that lists for both people and hastags are also created in the same way.

And we may also want to run these as multiple processes too at some point in the future to cut execution time.

Easy to follow article on structures for package installs

Strings, bytes, runes and characters in Go

Simon Harper ‏@sharpic 1h
More hassle #golang sorry in advance – strange switch problem giving undefined variable ideas?

THANKS – Damian Gryski ‏@dgryski 1h
@sharpic := scopes to the closest enclosing block, which is this code is the case body. Declare searchResult, err outside and use ‘=’

LESSON for TODAY: you have to be very careful when using the := notation if the scoping it this tight!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s