How can you be in two places at once when you're not anywhere at all?

git-svn-id: file:///srv/svn/repo/suwako/trunk@8 0b558ee1-521d-8b46-a41b-40029c97c055
This commit is contained in:
koizumi.aoi 2022-12-17 16:57:12 +00:00
parent faedcfb02e
commit 1d2d7d2020

View File

@ -6,7 +6,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net/http"
"net/url"
@ -42,11 +41,10 @@ func main() {
var encinput = url.PathEscape(input)
var queryURL = instance + "?engine=" + engine + "&from=" + from + "&to=" + to + "&text=" + encinput
// Begin the request and process the response
req, err := http.Get(queryURL)
resp, err := http.Get(queryURL)
sanityCheck(err)
defer req.Body.Close()
resp, err := io.ReadAll(req.Body)
_ = json.Unmarshal([]byte(resp), &translate)
defer resp.Body.Close()
_ = json.NewDecoder(resp.Body).Decode(&translate)
sanityCheck(err)
// Pretty-print both the input and the output given.
fmt.Printf("Input: %v\n", input)