package main import ( "fmt" "io/ioutil" "net/http" ) func main() { APIURL := "https://httpbin.org/get" req, err := http.NewRequest(http.MethodGet, APIURL, nil) if err != nil { panic(err) } client := http.DefaultClient resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Printf("%v", string(body)) }