Цель http получить запрос
func main() {
url := "https://jsonplaceholder.typicode.com/users/1"
client := http.Client{}
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
log.Fatal(err)
}
res, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
data, err := ioutil.ReadAll(res.Body)
defer res.Body.Close()
if err != nil {
log.Fatal(err)
}
person := Person{}
json.Unmarshal(data, &person)
fmt.Println(person)
}
Restu Wahyu Saputra