Changeset 8 in code for trunk/main.go
- Timestamp:
- Dec 17, 2022, 4:57:12 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/main.go
r7 r8 7 7 "flag" 8 8 "fmt" 9 "io"10 9 "log" 11 10 "net/http" … … 43 42 var queryURL = instance + "?engine=" + engine + "&from=" + from + "&to=" + to + "&text=" + encinput 44 43 // Begin the request and process the response 45 re q, err := http.Get(queryURL)44 resp, err := http.Get(queryURL) 46 45 sanityCheck(err) 47 defer req.Body.Close() 48 resp, err := io.ReadAll(req.Body) 49 _ = json.Unmarshal([]byte(resp), &translate) 46 defer resp.Body.Close() 47 _ = json.NewDecoder(resp.Body).Decode(&translate) 50 48 sanityCheck(err) 51 49 // Pretty-print both the input and the output given.
Note:
See TracChangeset
for help on using the changeset viewer.