(codehash, code, sourcePath string)
| 120 | } |
| 121 | |
| 122 | func resetURLHashFile(codehash, code, sourcePath string) string { |
| 123 | if verbose() { |
| 124 | fmt.Println(" Sending request to play.golang.org") |
| 125 | } |
| 126 | payload := strings.NewReader(code) |
| 127 | resp, err := http.Post("https://play.golang.org/share", "text/plain", payload) |
| 128 | check(err) |
| 129 | defer resp.Body.Close() |
| 130 | body, err := io.ReadAll(resp.Body) |
| 131 | check(err) |
| 132 | urlkey := string(body) |
| 133 | data := fmt.Sprintf("%s\n%s\n", codehash, urlkey) |
| 134 | os.WriteFile(sourcePath, []byte(data), 0644) |
| 135 | return urlkey |
| 136 | } |
| 137 | |
| 138 | func parseSegs(sourcePath string) ([]*Seg, string) { |
| 139 | var ( |
no test coverage detected