Skip to content

Instantly share code, notes, and snippets.

@Naveennani777 Naveennani777/http_get.go forked from ijt/http_get.go
Created Jul 21, 2017

What would you like to do?
Example of using http.Get in go (golang)
package main
import (
func main() {
if len(os.Args) != 2 {
fmt.Fprintf(os.Stderr, "Usage: %s URL\n", os.Args[0])
response, err := http.Get(os.Args[1])
if err != nil {
} else {
defer response.Body.Close()
_, err := io.Copy(os.Stdout, response.Body)
if err != nil {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.