package lib import ( "encoding/json" "net/http" ) // Fetcher is the interface for a fetcher. type Fetcher interface { Fetch() []string } func getJSON(req *http.Request, target interface{}) error { res, err := http.DefaultClient.Do(req) if err != nil { return err } defer res.Body.Close() return json.NewDecoder(res.Body).Decode(target) }