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:
parent
faedcfb02e
commit
1d2d7d2020
8
main.go
8
main.go
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -42,11 +41,10 @@ func main() {
|
|||||||
var encinput = url.PathEscape(input)
|
var encinput = url.PathEscape(input)
|
||||||
var queryURL = instance + "?engine=" + engine + "&from=" + from + "&to=" + to + "&text=" + encinput
|
var queryURL = instance + "?engine=" + engine + "&from=" + from + "&to=" + to + "&text=" + encinput
|
||||||
// Begin the request and process the response
|
// Begin the request and process the response
|
||||||
req, err := http.Get(queryURL)
|
resp, err := http.Get(queryURL)
|
||||||
sanityCheck(err)
|
sanityCheck(err)
|
||||||
defer req.Body.Close()
|
defer resp.Body.Close()
|
||||||
resp, err := io.ReadAll(req.Body)
|
_ = json.NewDecoder(resp.Body).Decode(&translate)
|
||||||
_ = json.Unmarshal([]byte(resp), &translate)
|
|
||||||
sanityCheck(err)
|
sanityCheck(err)
|
||||||
// Pretty-print both the input and the output given.
|
// Pretty-print both the input and the output given.
|
||||||
fmt.Printf("Input: %v\n", input)
|
fmt.Printf("Input: %v\n", input)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user