func getTweets(username string, count string, consumer oauth.Credentials, access oauth.Credentials) (tweets []Tweet, err error) { // Pull a X number of tweets associated with a user. // Docs: https://dev.twitter.com/rest/reference/get/statuses/user_timeline client := oauth.Client{Credentials: consumer} params := url.Values{"screen_name": {username}, "count": {count}} resp, err := client.Get( http.DefaultClient, &access, "https://api.twitter.com/1.1/statuses/user_timeline.json", params) if err != nil { return nil, err } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, err } err = json.Unmarshal(body, &tweets) if err != nil { return nil, err } return tweets, nil }