package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
// Step 1: Specify the URL for the GET request
url := "https://example.com/api/data"
// Step 2: Make the GET request
response, err := http.Get(url)
if err != nil {
fmt.Println("Error making GET request:", err)
return
}
defer response.Body.Close()
// Step 3: Read the response body
body, err := ioutil.ReadAll(response.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
// Step 4: Print the response body
fmt.Println(string(body))
}