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)
|
||||
resp, err := http.Post("https://play.golang.org/share", "text/plain", payload)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
check(err)
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
check(err)
|
||||
urlkey := string(body)
|
||||
data := fmt.Sprintf("%s\n%s\n", codehash, urlkey)
|
||||
ioutil.WriteFile(sourcePath, []byte(data), 0644)
|
||||
|
Loading…
x
Reference in New Issue
Block a user