Add error check to generate go
This commit is contained in:
parent
7311e83283
commit
5f6871027f
@ -153,11 +153,10 @@ func resetURLHashFile(codehash, code, sourcePath string) string {
|
|||||||
}
|
}
|
||||||
payload := strings.NewReader(code)
|
payload := strings.NewReader(code)
|
||||||
resp, err := http.Post("https://play.golang.org/share", "text/plain", payload)
|
resp, err := http.Post("https://play.golang.org/share", "text/plain", payload)
|
||||||
if err != nil {
|
check(err)
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
|
check(err)
|
||||||
urlkey := string(body)
|
urlkey := string(body)
|
||||||
data := fmt.Sprintf("%s\n%s\n", codehash, urlkey)
|
data := fmt.Sprintf("%s\n%s\n", codehash, urlkey)
|
||||||
ioutil.WriteFile(sourcePath, []byte(data), 0644)
|
ioutil.WriteFile(sourcePath, []byte(data), 0644)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user