I have the following code:
package main
import (
\"encoding/json\"
\"fmt\"
\"io/ioutil\"
\"log\"
\"net/http\"
\"time\"
)
type twitt
If you want to test your program, it is often best to write it with testing in mind. For instance, if you extracted the inner loop of your retrieveTweets
function into something like this:
func downloadTweets(tweetsUrl string) (*twitterResult, error)
You could invoke it with the URL of a test server you've set up using the httptest
package without having to worry about the sleeps or repeated requests.