Skip to content

Instantly share code, notes, and snippets.

@RicardoLinck
Created May 20, 2020 10:34
Show Gist options
  • Save RicardoLinck/0201f2b787f16a005eeb0a997b2b39a3 to your computer and use it in GitHub Desktop.
Save RicardoLinck/0201f2b787f16a005eeb0a997b2b39a3 to your computer and use it in GitHub Desktop.
Query used in other examples
package main
import (
"fmt"
"io/ioutil"
"net/http"
"time"
)
func executeQuery(url string) string {
start := time.Now()
response, _ := http.Get(url)
defer response.Body.Close()
body, _ := ioutil.ReadAll(response.Body)
fmt.Printf("Request time: %d ms from url%s\n", time.Since(start).Nanoseconds()/time.Millisecond.Nanoseconds(), url)
return fmt.Sprintf("%s from %s", body, url)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment