I've bashed up this Go twitter client below, the client still needs some work in terms of displaying the results, I'd like to represent the JSON result http://pastie.org/7298856 as a Go struct, I don't need all the fields in the JSON result, any pointers?
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
type TwitterResult struct{
}
var twitterUrl = "http://search.twitter.com/search.json?q=%23KOT"
func retrieveTweets(c chan<- string) {
for {
resp, err := http.Get(twitterUrl)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
c <- string(body)
}
}
func displayTweets(c chan string) {
fmt.Println(<-c)
}
func main() {
c := make(chan string)
go retrieveTweets(c)
for {
displayTweets(c)
}
}