-
Notifications
You must be signed in to change notification settings - Fork 1
/
macros.po
33 lines (28 loc) · 870 Bytes
/
macros.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//invoked via "go run ..\..\strickyak\prego\main.go --noinline <macros.po >macros.go", but doesn't work
// +build main
package main
import "fmt"
func (inline) TEMPLATE_httpGetJson(funcName string, dataType string) {
func funcName(url string, timeout float, pm PrintMask) {
resp, err := httpGet(newsRequestUrl, timeout)
if err != nil {
prVal(pm, "httpGetJson request err", err)
return false
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
prVal(pm, "httpGetJson read err", err)
return false
}
// Parse the News Sources json.
var data dataType
err = json.Unmarshal(body, &data)
if err != nil {
prVal(pm, "httpGetJson unmarshall err", err)
return false
}
}
}
macro.TEMPLATE_httpGetJson(httpGetJson_NewsResp, NewsResp)
macro.TEMPLATE_httpGetJson(httpGetJson_NewsSourcesResp, NewsSourcesResp)