9951 explained code solutions for 126 technologies


golangHow to make GET request using HTTP client


package main

import ("net/http"; "os"; "io")

func main() {
  r, _ := http.Get("https://echoof.me")
  defer r.Body.Close()
  io.Copy(os.Stdout, r.Body)
}ctrl + c
package main

default package declaration

net/http

http package to work with http protocol

http.Get(

executes GET request to the specified URL

io.Copy(os.Stdout, r.Body)

output response body to stdout