package mc import ( "io" "io/ioutil" "net/http" "os" ) func httpReq(url string) []byte { resp, err := http.Get(url) if err != nil { print(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { print(err) } return body } func downloadFile(filepath string, url string) error { // Get the data resp, err := http.Get(url) if err != nil { return err } defer resp.Body.Close() // Create the file out, err := os.Create(filepath) if err != nil { return err } defer out.Close() // Write the body to file _, err = io.Copy(out, resp.Body) return err }