0 points

Golang http GET request


dashboard

Sat Nov 21 2020 21:55:13 GMT+0000 (UTC)

Posted by @narro #go

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	res, err := http.Get("https://raw.githubusercontent.com/asos-craigmorten/opine/0.12.0/examples/hello-world/index.ts")
	if err != nil {
		log.Fatal(err)
	}
	deno, err := ioutil.ReadAll(res.Body)
	res.Body.Close()
		if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s", deno)

}
content_copy Copy

To make an HTTP get request with Go

https://golang.org/pkg/net/http/